discourse/spec/controllers/omniauth_callbacks_controller_spec.rb

26 lines
728 B
Ruby
Raw Normal View History

2016-04-01 05:33:25 +08:00
require 'rails_helper'
describe Users::OmniauthCallbacksController do
2013-08-23 15:00:18 +08: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-08-23 15:00:18 +08:00
it "fails for unknown" do
expect(lambda {
Users::OmniauthCallbacksController.find_authenticator("twitter1")
}).to raise_error
end
2013-08-23 15:00:18 +08: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 15:00:18 +08:00
end
end