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:
move rspec-rails line in gemfile above shoulda-matchers
add require: :false shoulda-matchers in gemfile
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
Post a Comment