0

Working my way through Hartle's tutorial; I am in the process of setting up the development environment for his walk-through sample application. RSpec isn't passing a test, when I believe it should very well be; which leads me to believe of course there is something I am unaware of here that is bugging.

Failure:

Failures:

1) Static pages Home page should have the content 'Sample App' Failure/Error: visit '/static_pages/home' NoMethodError: undefined method visit' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fb0f97a9d90> # ./spec/requests/static_pages_spec.rb:8:inblock (3 levels) in '

Finished in 0.00289 seconds 1 example, 1 failure

Failed examples:

rspec ./spec/requests/static_pages_spec.rb:7 # Static pages Home page should have the content 'Sample App'

Home:

 is the home page for the
  <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  sample application.
</p>

static_pages_spec file:

require 'spec_helper'

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
user2698988
  • 339
  • 1
  • 3
  • 10
  • 1
    The problem is that `visit` is a method of Capybara, not of rspec, and it's not being found. Two possible reasons: 1) you haven't included Capybara properly, or 2) the directory name that Capybara looks for by default has changed. See the "possible duplicate" question above. – Jacob Mattison Oct 07 '13 at 12:37
  • You are looking for 'sample app' or 'sample application' – Neeraj Oct 07 '13 at 12:41
  • That solved it- thanks; I had been trying to get run the bundle exec for RSpec earlier, and I couldn't get it to start because of some error. I removed the Capybara file because it allowed the execution of the file; I added it back now. Test passes. – user2698988 Oct 07 '13 at 12:49

0 Answers0