discourse/spec/controllers/omniauth_callbacks_controll...

26 lines
780 B
Ruby
Raw Normal View History

require 'rails_helper'
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")
2016-05-29 23:38:04 -04:00
}).to raise_error(Discourse::InvalidAccess)
2013-08-23 03:00:18 -04:00
end
2013-08-23 03:00:18 -04:00
it "fails for unknown" do
expect(lambda {
Users::OmniauthCallbacksController.find_authenticator("twitter1")
2016-05-29 23:38:04 -04:00
}).to raise_error(Discourse::InvalidAccess)
2013-08-23 03:00:18 -04:00
end
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)
end
2013-08-23 03:00:18 -04:00
end
end