active_admin中Controller_specs中的路由错误

时间:2013-10-02 13:52:19

标签: ruby-on-rails rspec activeadmin

我已经设置了一些规范来测试我的活动管理员控制器。

it "assigns the requested blog to @blog" do
  @blog = FactoryGirl.create(:blog)
  get :show, id: @blog
  assigns(:blog).should eq(@blog) 
end

当我单独运行此spec文件时,它全部为绿色,但是当我运行所有规格时,我收到此错误:

Failure/Error: get :show, :id => @blog
         ActionView::Template::Error:
           No route matches {:id=>#<User id: nil, role: nil, phone: nil, name: nil, firm_id: nil, hourly_rate: nil, loginable_type: nil, loginable_id: nil, loginable_token: nil, created_at: nil, updated_at: nil, avatar_file_name: nil, avatar_content_type: nil, avatar_file_size: nil, avatar_updated_at: nil, email: "", encrypted_password: "", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil>, :controller=>"admin/blogs", :action=>"edit", :format=>nil} missing required keys: [:id]

知道什么是错的吗?

0 个答案:

没有答案