2016-08-19 101 views
2

我想跟着這Rails API Guide更好地瞭解如何將Rails API集成到我自己的應用程序,但是我的RSpec測試失敗的路由期望和I不知道爲什麼。RSpec控制器測試失敗與Rails API - 未定義方法'助手'

我的錯誤信息是

1) Api::V1::UsersController POST #create when is not created renders an errors json 
    Failure/Error: expect(user_response).to have_key(:errors) 
    NoMethodError: 
    undefined method "helpers" for # <ActionDispatch::Routing::RouteSet::NamedRouteCollection:0x007f7f8a1c0938> 
     Did you mean? helper_names 
    # ./spec/controllers/api/v1/users_controller_spec.rb:47:in <block (4 levels) in top (required)>' 

我覺得這個鏈接可能Gist是張貼代碼的緣故更方便。我很抱歉如果直接在我的帖子上發佈明文是首選。我是新來發布^^

+0

你可以發佈完整的錯誤跟蹤@Impossibeard –

+0

併發布你使用的是哪個版本的Rspec和Rails? –

+0

這就是我所犯的一個錯誤。有沒有辦法查看更深入的錯誤?我使用Rails 5.0和RSpec 2.99 – Impossibeard

回答

1

我也使用Rails 5並升級到「rspec-rails」,「〜> 3.5」似乎已經做了詭計!謝謝

相關問題