当我开始使用$ bundle exec rspec spec/
RSpec 进行单元测试时...
admin@ADMINPC /d/ruby/rails/projects/CMS (static-pages)
$ bundle exec rspec spec/
d:/ruby/rails/projects/CMS/spec/controllers/pages_controller_spec.rb:1:in `requi
re': cannot load such file -- spec_helper (LoadError)
from d:/ruby/rails/projects/CMS/spec/controllers/pages_controller_spec.r
b:1:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1
1.1/lib/rspec/core/configuration.rb:780:in `load'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1
1.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1
1.1/lib/rspec/core/configuration.rb:780:in `map'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1
1.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1
1.1/lib/rspec/core/command_line.rb:22:in `run'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1
1.1/lib/rspec/core/runner.rb:69:in `run'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1
1.1/lib/rspec/core/runner.rb:8:in `block in autorun'
如何解决这个问题?
文件 pages_controller_spec.rb:
require 'spec_helper'
describe PagesController do
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
end