Reputation: 29
I followed all the different solutions (or I think I did) on Github(https://github.com/rspec/rspec-rails/issues/360#issuecomment-55697207) and other similar posts on stackoverflow, but still could not get it working. I still see the NoMethodError. My repo is a really basic practice website. Please help at https://github.com/lukexuanliu/CornellBlog/tree/static_pages Thanks!
rails 4.1.5 rspec 3.1.3
bundle exec rspec spec/requests/static_pages_spec.rb F
Failures:
1) Static pages Home page should have the content 'PRACTICE RAILS'
Failure/Error: visit '/static_pages/home'
NoMethodError:
undefined method visit' for #<RSpec::ExampleGroups::StaticPages::HomePage:0x007fe3f40681c0>
# ./spec/requests/static_pages_spec.rb:7:in
block (3 levels) in '
Finished in 0.00051 seconds (files took 0.14214 seconds to load) 1 example, 1 failure
Failed examples:
rspec ./spec/requests/static_pages_spec.rb:6 # Static pages Home page should have the content 'PRACTICE RAILS'
Upvotes: 0
Views: 390
Reputation: 610
Try adding require 'rails_helper' as you are using the newer version.
In old versions, single file was generated which was spec_helper.rb. Now the details in this file have been moved to rails_helper.rb. The new spec_helper.rb is just a helper.
Upvotes: 0