1

我正在尝试按照这些说明为 devise + omniauth-linkedin 开发集成测试,但响应为零。该应用程序正在开发环境中运行,但测试未通过。

测试用例:

feature 'signup with linkedin' do

  before do 
    OmniAuth.config.test_mode = true
    OmniAuth.config.mock_auth[:linkedin] = OmniAuth::AuthHash.new({
      :provider => 'linkedin',
      :uid => '12345'
    })
  end

  scenario 'valid' do
    visit "/users/auth/linkedin"
    json = ActiveSupport::JSON.decode(response.body)

    json["uid"].should == '12345'
    json["provider"].should == 'linkedin'
  end

end

错误信息:

Failure/Error: json = ActiveSupport::JSON.decode(response.body)
     NoMethodError:
       undefined method `body' for nil:NilClass

有人可以帮忙吗?

如果你想看一下代码,该项目是开源的,你可以在这里找到它:StartupDealbook

4

0 回答 0