Remove use of stubs in tests.

This commit is contained in:
Guo Xiang Tan 2017-03-01 10:53:03 +08:00
parent 76dd6933d2
commit 107d6783a9
1 changed files with 7 additions and 6 deletions

View File

@ -4,20 +4,21 @@ describe Users::OmniauthCallbacksController do
context ".find_authenticator" do
it "fails if a provider is disabled" do
SiteSetting.stubs("enable_twitter_logins?").returns(false)
expect(lambda {
SiteSetting.enable_twitter_logins = false
expect {
Users::OmniauthCallbacksController.find_authenticator("twitter")
}).to raise_error(Discourse::InvalidAccess)
}.to raise_error(Discourse::InvalidAccess)
end
it "fails for unknown" do
expect(lambda {
expect {
Users::OmniauthCallbacksController.find_authenticator("twitter1")
}).to raise_error(Discourse::InvalidAccess)
}.to raise_error(Discourse::InvalidAccess)
end
it "finds an authenticator when enabled" do
SiteSetting.stubs("enable_twitter_logins?").returns(true)
SiteSetting.enable_twitter_logins = true
expect(Users::OmniauthCallbacksController.find_authenticator("twitter")).not_to eq(nil)
end
end