From d58a72ee32d74e354d797c330a4334388afd4643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 14 Mar 2011 11:22:09 +0100 Subject: [PATCH] Remove stuff deprecated on .rc2 --- Gemfile.lock | 2 +- lib/devise/omniauth/config.rb | 12 ----------- lib/devise/omniauth/test_helpers.rb | 31 ----------------------------- test/omniauth/test_helpers_test.rb | 25 ----------------------- 4 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 lib/devise/omniauth/test_helpers.rb delete mode 100644 test/omniauth/test_helpers_test.rb diff --git a/Gemfile.lock b/Gemfile.lock index bf40605c..03e820e4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - devise (1.2.rc) + devise (1.2.rc2) bcrypt-ruby (~> 2.1.2) orm_adapter (~> 0.0.3) warden (~> 1.0.3) diff --git a/lib/devise/omniauth/config.rb b/lib/devise/omniauth/config.rb index 47997ce1..b1d50f63 100644 --- a/lib/devise/omniauth/config.rb +++ b/lib/devise/omniauth/config.rb @@ -13,18 +13,6 @@ module Devise def strategy_class ::OmniAuth::Strategies.const_get("#{::OmniAuth::Utils.camelize(@provider.to_s)}") end - - def check_if_allow_stubs! - raise "OmniAuth strategy for #{@provider} does not allow stubs, only OAuth2 ones do." unless allow_stubs? - end - - def allow_stubs? - defined?(::OmniAuth::Strategies::OAuth2) && strategy.is_a?(::OmniAuth::Strategies::OAuth2) - end - - def build_connection(&block) - strategy.client.connection.build(&block) - end end end end \ No newline at end of file diff --git a/lib/devise/omniauth/test_helpers.rb b/lib/devise/omniauth/test_helpers.rb deleted file mode 100644 index 0ed1fa16..00000000 --- a/lib/devise/omniauth/test_helpers.rb +++ /dev/null @@ -1,31 +0,0 @@ -module Devise - module OmniAuth - module TestHelpers - DEPRECATION_MESSAGE = "Faraday changed the way mocks work in a way incompatible to Devise. Luckily, Omniauth now supports a new test mode, please use it in your tests instead: https://github.com/intridea/omniauth/wiki/Integration-Testing" - - DeprecationError = Class.new(StandardError) - - def self.stub!(*args) - raise DeprecationError, DEPRECATION_MESSAGE - end - - def self.reset_stubs!(*args) - raise DeprecationError, DEPRECATION_MESSAGE - end - - def self.test_mode! - warn DEPRECATION_MESSAGE - end - - def self.short_circuit_authorizers! - ::OmniAuth.config.test_mode = true - warn DEPRECATION_MESSAGE - end - - def self.unshort_circuit_authorizers! - ::OmniAuth.config.test_mode = false - warn DEPRECATION_MESSAGE - end - end - end -end diff --git a/test/omniauth/test_helpers_test.rb b/test/omniauth/test_helpers_test.rb deleted file mode 100644 index 118a7089..00000000 --- a/test/omniauth/test_helpers_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'test_helper' - -class OmniAuthTestHelpersTest < ActiveSupport::TestCase - test "Assert that stub! raises deprecation error" do - assert_raises Devise::OmniAuth::TestHelpers::DeprecationError do - Devise::OmniAuth::TestHelpers.stub! - end - end - - test "Assert that reset_stubs! raises deprecation error" do - assert_raises Devise::OmniAuth::TestHelpers::DeprecationError do - Devise::OmniAuth::TestHelpers.reset_stubs! - end - end - - test "Assert that short_circuit_authorizers! warns about deprecation" do - Devise::OmniAuth::TestHelpers.short_circuit_authorizers! - assert ::OmniAuth.config.test_mode - end - - test "Assert that unshort_circuit_authorizers! warns about deprecation" do - Devise::OmniAuth::TestHelpers.unshort_circuit_authorizers! - assert ! ::OmniAuth.config.test_mode - end -end