ruby - adding spring gem breaks tests - rails -


i have test using rails spec (and capybara , factory girl) , passing fine

describe "project creation"   before(:each)     @project = factorygirl.create(:project)   end   "create projects fluently"     visit root_path     @project.should validate_presence_of(:title)   end end 

then installed spring, , when run spring rspec spec/features/projects_spec.rb, throws

failure/error: @project.should validate_presence_of(:title)      nomethoderror:        undefined method `validate_presence_of' #<rspec::core::examplegroup... 

how can be

this issue discussed here: https://github.com/rails/spring/issues/209, in readme file of shoulda-matchers gem how install preloader, solution was:

  1. move rspec-rails line in gemfile above shoulda-matchers

  2. add require: :false shoulda-matchers in gemfile

  3. add require 'shoulda/matchers' in spec_helper.rb

my gemfile like:

group :test   gem "rspec-rails"   gem 'shoulda-matchers', require: false   gem 'machinist' end 

now specs shoulda helper work fine spring!


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -