I follow M Hartl's "Ruby on Rails Tutorial", Chap 3.2.2
When I add /static_pages/about to routes.rb, even the 'about' action is NOT defined in static_pages_controller.rb, the rspec test passes.
It is driving me crazy!
I am using ruby-2.1.1, rspec-rails 2.14.2, Capybara 2.1.0
static_pages_spec.rb:
require 'spec_helper'
describe "StaticPages" do
describe "About" do
it "should have the content 'About'" do
visit '/static_pages/about'
expect(page).to have_content('About')
end
end
end
routes.rb:
RortSampleApp::Application.routes.draw do
get "static_pages/about"
end
static_pages_controller.rb:
class StaticPagesController < ApplicationController
end
command running the rspec test & result:
$ rspec spec/requests/static_pages_spec.rb
.
Finished in 0.02604 seconds
1 example, 0 failures
Randomized with seed 61832
And the test.log:
(0.1ms) begin transaction
Started GET "/static_pages/about" for 127.0.0.1 at 2014-04-02 01:59:45 -0700
AbstractController::ActionNotFound - The action 'about' could not be found for StaticPagesController:
actionpack (4.0.4) lib/abstract_controller/base.rb:131:in `process'
actionpack (4.0.4) lib/abstract_controller/rendering.rb:44:in `process'