I m followind the Rails Tutorial but have a problem in section 3.2.1, just before figure 3.6. When running
$ bundle exec rspec spec/requests/static_pages_spec.rb
我的失败
Failures:
1) StaticPages GET /static_pages works! (now write some real specs)
Failure/Error: get static_pages_index_path
NameError:
undefined local variable or method `static_pages_index_path for # <RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fe7592b33b8>
# ./spec/requests/static_pages_spec.rb:7:in `block (3 levels) in <top (required)>
Finished in 0.00454 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/requests/static_pages_spec.rb:5 # StaticPages GET /static_pages works! (now write some real specs)
档案:
spec/requests/static_pages_spec.rb
require spec_helper
describe "Static pages" do
describe "Home page" do
it "should have the content Sample App " do
visit /static_pages/home
page.should have_content( Sample App )
end
end
end
app/controllers/static_pages_controller.rb
class StaticPagesController < ApplicationController
def home
end
def help
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>
config/routes.rb
SecondApp::Application.routes.draw do
get "static_pages/home"
get "static_pages/help"
end
Gemfile
source https://rubygems.org
gem rails , 3.2.3
group :development do
gem sqlite3 , 1.3.5
gem rspec-rails , 2.9.0
gem guard-rspec , 0.5.5
end
group :assets do
gem sass-rails , 3.2.4
gem coffee-rails , 3.2.2
gem uglifier , 1.2.3
end
gem jquery-rails , 2.0.0
group :test do
gem rspec-rails , 2.9.0
gem capybara , 1.1.2
gem growl , 1.0.3
end
group :production do
gem pg , 0.12.2
end
任何关于我有错的想法?