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