While following Michael Hartl's RonR tutorial im in the process of trying to get my Home page to pass my written test. Unfortunately im unable to figure out why I have a failure? Any help would be much appreciated..
spec/requests/static_pages_spec.rb
require spec helper
require 'minitest/autorun'
describe "Static pages" do
describe "Home page" do
it "should have the content 'Sample App'" do
visit '/static_pages/home'
expect(page).to have_content('Sample App')
end
end
end
app/views/static_pages/home.html.erb
<h1>Sample App</h1>
<p> This is the home page for the
<a href="http://railstutorial.org/">Ruby on rails Tutorial</a>
sample application.
</p>
and so I run..
$bundle exec rspec spec/requests/static_pages_spec.rb
the outcome is...
Failures:
1) Static pages Home page should have the content 'Sample App'
←[31mFailure/Error:←[0m ←[31mvisit '/static_pages/home' # Run the generator again with the --webrat flag if you want to use webrat m
ethods/matchers←[0m
←[31mNoMethodError←[0m:
←[31mundefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x5ba9688>←[0m
←[36m # ./spec/requests/static_pages_spec.rb:9:in `block (3 levels) in <top (required)>'←[0m
Finished in 0.002 seconds
←[31m1 example, 1 failure←[0m
Failed examples:
←[31mrspec ./spec/requests/static_pages_spec.rb:8←[0m ←[36m# Static pages Home page should have the content 'Sample App'←[0m