Created
February 12, 2015 18:18
-
-
Save erickrause/4a9c3c9358dd7c161fe4 to your computer and use it in GitHub Desktop.
Quick guide to get rspec and spring running.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gemfile | |
group :development, :test do | |
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring | |
gem 'spring' | |
gem "spring-commands-rspec" | |
gem 'rspec-rails' | |
gem 'database_cleaner' | |
gem 'factory_girl_rails' | |
end | |
group :test do | |
gem 'guard' | |
gem 'guard-spring' | |
gem 'shoulda-matchers', require: false | |
end | |
Then run | |
$ bundle install | |
$ bundle exec spring binstub --all | |
Guardfile | |
# A sample Guardfile | |
# More info at https://github.com/guard/guard#readme | |
guard 'spring', :rspec_cli => '--color' do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^spec/spec_helper\.rb$}) { |m| 'spec' } | |
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim|jbuilder)$}) { |m| "spec/api/#{m[1]}_spec.rb" } | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) do |m| | |
%W(spec/routing/#{m[1]}_routing_spec.rb spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb spec/requests/#{m[1]}_spec.rb spec/api/#{m[1]}_spec.rb) | |
end | |
end | |
#Then just run | |
spring status | |
guard | |
#Then in another console run 'spring status' again | |
# One note. The times of the test suite will go off the original time of the process. So ignore them. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment