【发布时间】:2012-10-13 03:20:15
【问题描述】:
我正在尝试在 Cucumber 中测试我的 Facebook 登录按钮。我正在使用 Omniauth。
这是我在 /features/support/env.rb 中的内容
Before do
OmniAuth.config.test_mode = true
OmniAuth.config.add_mock(:facebook, {
provider: 'facebook',
uid: '1259910065',
info: {
name: 'Test Name',
email: 'test@example.com'
}
})
end
After do
OmniAuth.config.test_mode = false
end
但是,当我尝试在测试中访问 /auth/facebook 时,我得到:
No route matches [GET] "/auth/facebook" (ActionController::RoutingError)
更新:
我也尝试在 env.rb 文件中require 'omniauth',但我不确定是否有必要。
【问题讨论】:
-
你在使用omniauth-facebook gem吗? github.com/mkdynamic/omniauth-facebookomniauth 本身不支持facebook,你需要一个策略:github.com/intridea/omniauth/wiki/List-of-Strategies
-
该网站运行良好。当我单击浏览器中的按钮时,它会转到
'/auth/facebook'并正确登录。所以是的,我正在使用facebook-omniauthgem。好问题。 -
我只关心测试。
-
嗨@ardavis,你是怎么解决这个问题的???请让我知道我一周以来就面临这个问题。
-
不幸的是我没有。我没时间做那个项目,它被搁置了。
标签: ruby-on-rails cucumber omniauth