Rails 5.1升级后RSpec方法失败

时间:2018-06-08 16:21:22

标签: ruby-on-rails rspec omniauth

我刚刚将旧版应用程序从Rails 3.2升级到Rails 5.1.6。这个测试曾经工作但现在失败了:

# spec/requests/social_sign_ups_spec.rb
describe 'Twitter sign ups:' do

  before(:each)  do
    OmniAuth.config.test_mode = true
  end

  it 'Logs in new user:' do
    visit new_session_path
    OmniAuth.config.mock_auth[:twitter] = OmniAuth::AuthHash.new({
        'provider' => 'twitter',
        'uid' =>  Twitter_identifier,
        'info' => {
             'name' => 'squiddio',
             'image' => "http://pbs.twimg.com/profile_images/568944504166567936/UcqveaGp_normal.png"
         },
        'credentials' => {
            "token" =>  Twitter_token,
            "secret" => Twitter_token_secret
        }
    })

    click_link 'Twitter log-in'
    # this is where I get the callback error in the server- see logs below


  end
end

查看服务器日志:

tail -f log/test.log
# .......
# Completed 200 OK in 2268ms (Views: 2263.5ms | ActiveRecord: 1.6ms)
# Started GET "/auth/twitter" for 127.0.0.1 at 2018-06-08 08:32:01 -0700
# Started GET "/oauth/authenticate?oauth_token=<some token>" for 127.0.0.1 at 2018-06-08 08:32:01 -0700   

# ActionController::RoutingError (No route matches [GET] "/oauth/authenticate"):

# .......

任何人都可以找出为什么来自Rack的回调是:

/oauth/authenticate 

而不是标准:

/auth/twitter/callback 

我参与开发和生产?

其他信息:

bundle show rails  # -> rails-5.1.6
bundle show rspec-rails # -> rspec-rails-3.7.2

0 个答案:

没有答案