google-authenticator-rails 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 440ad5551c31c754fd9870dfd810d9ea97969627f5a97e058c336cc8148b5e59
4
- data.tar.gz: 1324392b3336a8ebe39c5c57c117412472d33b9985be59b6a11e72d62414955c
3
+ metadata.gz: cbb1026a266573661287bef3b6c6bdc3d378366301eb7d7c5f30ed7ea1f66c12
4
+ data.tar.gz: 30a37ae8d964980695f17a4aab1c4dfc74e4e6d548180ef06eaa5c1eb7f5bc4f
5
5
  SHA512:
6
- metadata.gz: 98c1cfa7de93eb922afc7c6d58db9fccb732be27e092846902db62993b75f4d55768c57f3352b56ffd28e3c2350faa17c8b458b61e02bf143b54458ceb856124
7
- data.tar.gz: 724c84f98fbe300eb2488dcb2c24649592df811e65d1af5fc8c17aeec14c069102e5a3564592083cc131f2de193e95d82d8d44f4a904874c0e5faf59203573f0
6
+ metadata.gz: 1340e9ebdcc67cdef420bc9d078f8c6c40a00fa6d276ff2f11b411070fc86bfd7eaf64ea0e7088ac253071fddbdf32c497fe5568e6edfd1a417022f2933bc3a4
7
+ data.tar.gz: 18058f4a6a6680e6707b7838d2f7d2ea0aa33f99cdc4bf9aafcf5fd0d5674d94729e6b7736208f6f8f826d68ab76db6000e0a227088e68632c1d31dcd1b0e618
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- google-authenticator-rails (3.0.0)
4
+ google-authenticator-rails (3.1.0)
5
5
  actionpack
6
6
  activerecord
7
7
  rails
@@ -92,7 +92,7 @@ GEM
92
92
  activesupport (>= 5.0)
93
93
  i18n (1.10.0)
94
94
  concurrent-ruby (~> 1.0)
95
- loofah (2.18.0)
95
+ loofah (2.19.1)
96
96
  crass (~> 1.0.2)
97
97
  nokogiri (>= 1.5.9)
98
98
  mail (2.7.1)
@@ -100,8 +100,7 @@ GEM
100
100
  marcel (1.0.2)
101
101
  method_source (1.0.0)
102
102
  mini_mime (1.1.2)
103
- mini_portile2 (2.8.0)
104
- minitest (5.15.0)
103
+ minitest (5.16.0)
105
104
  net-imap (0.2.3)
106
105
  digest
107
106
  net-protocol
@@ -117,10 +116,9 @@ GEM
117
116
  net-protocol
118
117
  timeout
119
118
  nio4r (2.5.8)
120
- nokogiri (1.13.6)
121
- mini_portile2 (~> 2.8.0)
119
+ nokogiri (1.13.10-arm64-darwin)
122
120
  racc (~> 1.4)
123
- racc (1.6.0)
121
+ racc (1.6.1)
124
122
  rack (2.2.3.1)
125
123
  rack-test (1.1.0)
126
124
  rack (>= 1.0, < 3)
@@ -141,8 +139,8 @@ GEM
141
139
  rails-dom-testing (2.0.3)
142
140
  activesupport (>= 4.2.0)
143
141
  nokogiri (>= 1.6)
144
- rails-html-sanitizer (1.4.3)
145
- loofah (~> 2.3)
142
+ rails-html-sanitizer (1.4.4)
143
+ loofah (~> 2.19, >= 2.19.1)
146
144
  railties (7.0.3)
147
145
  actionpack (= 7.0.3)
148
146
  activesupport (= 7.0.3)
@@ -184,7 +182,7 @@ GEM
184
182
  websocket-driver (0.7.5)
185
183
  websocket-extensions (>= 0.1.0)
186
184
  websocket-extensions (0.1.5)
187
- zeitwerk (2.5.4)
185
+ zeitwerk (2.6.0)
188
186
 
189
187
  PLATFORMS
190
188
  ruby
@@ -20,7 +20,9 @@ module GoogleAuthenticatorRails
20
20
 
21
21
  module Integration
22
22
  def self.included(klass)
23
- raise RailsAdapter::LoadedTooLateError.new if defined?(::ApplicationController)
23
+ if klass.descendants.map(&:name).include?("ApplicationController")
24
+ raise RailsAdapter::LoadedTooLateError.new
25
+ end
24
26
 
25
27
  method = klass.respond_to?(:prepend_before_action) ? :prepend_before_action : :prepend_before_filter
26
28
  klass.send(method, :activate_google_authenticator_rails)
@@ -1,3 +1,3 @@
1
1
  module GoogleAuthenticatorRails
2
- VERSION = "3.0.0"
2
+ VERSION = "3.1.0"
3
3
  end
@@ -3,9 +3,9 @@ require 'spec_helper'
3
3
  describe GoogleAuthenticatorRails::ActionController::Integration do
4
4
  describe '::included' do
5
5
  context 'ApplicationController already defined' do
6
- before { class ApplicationController < MockController; end }
7
- after { Object.send(:remove_const, :ApplicationController) }
8
- subject { lambda { MockController.send(:include, GoogleAuthenticatorRails::ActionController::Integration) } }
6
+ # Autoload ApplicationController.
7
+ before { ApplicationController }
8
+ subject { lambda { MockControllerWithApplicationController.send(:include, GoogleAuthenticatorRails::ActionController::Integration) } }
9
9
 
10
10
  it { should raise_error(GoogleAuthenticatorRails::ActionController::RailsAdapter::LoadedTooLateError) }
11
11
  end
data/spec/spec_helper.rb CHANGED
@@ -13,8 +13,18 @@ SimpleCov.start
13
13
 
14
14
  require 'google-authenticator-rails'
15
15
 
16
- class MockController
17
- class << self
16
+ module MockControllerBase
17
+ def self.included(klass)
18
+ klass.class_eval do
19
+ extend ClassMethods
20
+
21
+ include GoogleAuthenticatorRails::ActionController::Integration
22
+
23
+ attr_accessor :cookies
24
+ end
25
+ end
26
+
27
+ module ClassMethods
18
28
  attr_accessor :callbacks
19
29
 
20
30
  def prepend_before_filter(filter)
@@ -23,15 +33,22 @@ class MockController
23
33
  end
24
34
  end
25
35
 
26
- include GoogleAuthenticatorRails::ActionController::Integration
27
-
28
- attr_accessor :cookies
29
-
30
36
  def initialize
31
37
  @cookies = MockCookieJar.new
32
38
  end
33
39
  end
34
40
 
41
+ class MockController
42
+ include MockControllerBase
43
+ end
44
+
45
+ class MockControllerWithApplicationController
46
+ include MockControllerBase
47
+ end
48
+
49
+ # Simulate Rails' autoloading for ApplicationController.
50
+ autoload :ApplicationController, File.join(File.dirname(__FILE__), 'support/application_controller')
51
+
35
52
  class MockCookieJar < Hash
36
53
  def [](key)
37
54
  hash = super
@@ -0,0 +1,2 @@
1
+ class ApplicationController < MockControllerWithApplicationController
2
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-authenticator-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared McFarland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-17 00:00:00.000000000 Z
11
+ date: 2023-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rotp
@@ -190,6 +190,7 @@ files:
190
190
  - spec/session/activation_spec.rb
191
191
  - spec/session/persistance_spec.rb
192
192
  - spec/spec_helper.rb
193
+ - spec/support/application_controller.rb
193
194
  homepage: http://github.com/jaredonline/google-authenticator
194
195
  licenses: []
195
196
  metadata: {}
@@ -219,3 +220,4 @@ test_files:
219
220
  - spec/session/activation_spec.rb
220
221
  - spec/session/persistance_spec.rb
221
222
  - spec/spec_helper.rb
223
+ - spec/support/application_controller.rb