I am very new to RoR and am following the Rails Tutorials. I created a Pages controller and first created just Home and Contact pages and ran the test. Both the examples passed. Next, I manually added a third 'about' page and made the appropriate changes. However, the third 'about' example is failing with spork running. Once I closed spork, the examples passed. Here is the output with spork running:
Failed examples:
rspec ./spec/controllers/pages_controller_spec.rb:21 # PagesController GET 'about' returns http success
Randomized with seed 15477
Here is my pages_controller_spec.rb:
require 'spec_helper'
describe PagesController do
render_views
describe "GET 'home'" do
it "returns http success" do
get 'home'
response.should be_success
end
end
describe "GET 'contact'" do
it "returns http success" do
get 'contact'
response.should be_success
end
end
describe "GET 'about'" do
it "returns http success" do
get 'about'
response.should be_success
end
end
end
Added this line to routes.rb :
get "pages/about"
Added this line to pages_controller.rb:
def about
end
And added the about.html.erb in the views folder.
Also, the url- localhost:3000/pages/about works from the browser. I am not sure why this example is failing.
If you are already running spork and attempt to make changes to the routes, those changes will not be reflected until spork has been restarted. This is most likely the cause of that particular test failure.