2015-10-11 04:41:23 -05:00
|
|
|
require 'rails_helper'
|
2013-03-04 12:44:41 -06:00
|
|
|
|
|
|
|
describe Users::OmniauthCallbacksController do
|
|
|
|
|
2013-08-23 02:00:18 -05:00
|
|
|
context ".find_authenticator" do
|
|
|
|
it "fails if a provider is disabled" do
|
2017-02-28 20:53:03 -06:00
|
|
|
SiteSetting.enable_twitter_logins = false
|
|
|
|
|
|
|
|
expect {
|
2013-08-23 02:00:18 -05:00
|
|
|
Users::OmniauthCallbacksController.find_authenticator("twitter")
|
2017-02-28 20:53:03 -06:00
|
|
|
}.to raise_error(Discourse::InvalidAccess)
|
2013-08-23 02:00:18 -05:00
|
|
|
end
|
2013-07-04 01:30:13 -05:00
|
|
|
|
2013-08-23 02:00:18 -05:00
|
|
|
it "fails for unknown" do
|
2017-02-28 20:53:03 -06:00
|
|
|
expect {
|
2013-08-23 02:00:18 -05:00
|
|
|
Users::OmniauthCallbacksController.find_authenticator("twitter1")
|
2017-02-28 20:53:03 -06:00
|
|
|
}.to raise_error(Discourse::InvalidAccess)
|
2013-08-23 02:00:18 -05:00
|
|
|
end
|
2013-07-04 01:30:13 -05:00
|
|
|
|
2013-08-23 02:00:18 -05:00
|
|
|
it "finds an authenticator when enabled" do
|
2017-02-28 20:53:03 -06:00
|
|
|
SiteSetting.enable_twitter_logins = true
|
2013-08-23 02:00:18 -05:00
|
|
|
expect(Users::OmniauthCallbacksController.find_authenticator("twitter")).not_to eq(nil)
|
2013-07-04 01:30:13 -05:00
|
|
|
end
|
2013-08-23 02:00:18 -05:00
|
|
|
end
|
2013-07-04 01:30:13 -05:00
|
|
|
|
2013-03-04 12:44:41 -06:00
|
|
|
end
|