rspec 常见错误

1 ActionView::Template::Error: Missing host to link to! Please provide :host parameter or set default_url_options[:host]
解决:config.action_mailer.default_url_options = { :host => 'mywebsitename.com' }
2  routing:
实例:it "routes to #release" do
    #  post("/admin/pickcontents/1/release").should route_to("admin/pickcontents#release", :id => 1)
      post("/admin/pickcontents/1/release").should route_to( :action => "release",:controller => "admin/pickcontents", :id => "1")
    end

错误信息:The recognized options <{"action"=>"release", "controller"=>"admin/pickcontents", "id"=>"1"}> did not match <{"id"=>1, "controller"=>"admin/pickcontents", "action"=>"release"}>, difference: <{"id"=>1}>

路由配置:   resources :pickcontents do
      memeber do
        post "release"
      end
end
解析:当使用注释处报错,因为项的不匹配,要是使用member匹配的路由要单独制定controller或者anction

你可能感兴趣的:(rsp)