From 107d6783a9d36a7db7d9572d84e0740638d3d531 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 1 Mar 2017 10:53:03 +0800 Subject: [PATCH] Remove use of stubs in tests. --- .../omniauth_callbacks_controller_spec.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/spec/controllers/omniauth_callbacks_controller_spec.rb b/spec/controllers/omniauth_callbacks_controller_spec.rb index de2a7d8f4d1..df05b2c2f17 100644 --- a/spec/controllers/omniauth_callbacks_controller_spec.rb +++ b/spec/controllers/omniauth_callbacks_controller_spec.rb @@ -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