我有一个控制器,它需要一个名为的参数controller,而我编写的 RSpec 测试似乎不喜欢我将它作为参数传递给get.
规格
require 'spec_helper'
describe PageHelpsController do
  describe 'GET :search' do
    it "returns" do
      get :search, { :controller => 'employer', :action => 'edit', :edition => 'usa', :anchor => 'collaborator' }
      response.status.should be_success
      response.should render_template(:partial => 'shared/page_help')
    end
  end
end
错误
vagrant@debian-squeeze64:/vagrant$ bundle exec rspec spec/controllers/page_helps_controller_spec.rb 
F
Failures:
  1) PageHelpsController GET :search returns
     Failure/Error: Unable to find /vagrant/spec/controllers/page_helps_controller_spec.rb to read failed line
     ActionController::RoutingError:
       No route matches {:controller=>"employer", :action=>"search", :relative_url_root=>nil, :edition=>"usa"}
     # ./spec/controllers/page_helps_controller_spec.rb:11