I’m trying to use RSPec to test my Ruby on Rails 3.2 app.
When I generated the controller, some specs were created for the views and the controller. I tried adding the following test to the controller spec:
it "should have h1 of Home" do
visit '/home/index'
page.should have_selector('h1', text: "Home")
end
But couldn’t get it to pass.
When I ran rails generate integration_test home and put the same test in the homes_spec, the test works fine.
Why does it matter where the spec goes?
Thanks
According to the doc:
And request specs live in
integrationandrequestsfolders.Simply.