oauth_im 0.9.2 → 0.9.3
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 +4 -4
- data/README.md +3 -0
- data/config/initializers/app_context.rb +39 -12
- data/lib/oauth_im/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59850b2078fcdc211be2d3a43ca7f7d3e0aaf4a433e1a703e48e3ac0942e8bdc
|
4
|
+
data.tar.gz: 228df263b5f216a455ea5cd0365ae97d77ff48e1e0bd527850977e1a7d0fa262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37e2f602d2de4058a194d01af1074c6bc2f5231f0fb5a13efe8c77b8b80dc7344cf35f6c7e139310352bef8e07b93796d3088b966245c3db0bb6f15bf5ab87a9
|
7
|
+
data.tar.gz: 48e15c481324112a37afb2400938f3d2dc13e8e173adeb86505ab079d5d3b77e2fb66e64fad211057f89e5e5ab31bbbf111de3ee3ad791ce951f0d2b3b250c69
|
data/README.md
CHANGED
@@ -139,6 +139,9 @@ After many false starts, this repo includes two (seemingly functional) github wo
|
|
139
139
|
|
140
140
|
## Version History
|
141
141
|
|
142
|
+
### 0.9.3
|
143
|
+
* added specs for AppContext initializer
|
144
|
+
|
142
145
|
### 0.9.2
|
143
146
|
* Fix redirect url
|
144
147
|
* No longer does it take user back to page they were on
|
@@ -1,36 +1,63 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module AppContext
|
4
|
-
|
4
|
+
module_function
|
5
|
+
|
6
|
+
TEST_ENV_ERROR_MESSGE = 'Use only in test environment!'
|
7
|
+
DEFAULT_SPEC_USER_DATA = {}.freeze
|
8
|
+
|
9
|
+
def provide_authentication?
|
5
10
|
true
|
6
11
|
end
|
7
12
|
|
8
|
-
def
|
13
|
+
def provide_auth_routes?
|
14
|
+
provide_authentication?
|
15
|
+
end
|
16
|
+
|
17
|
+
def spec_user
|
9
18
|
@spec_user if override_for_specs?
|
10
19
|
end
|
11
20
|
|
12
|
-
def
|
21
|
+
def authenticated_for_specs?
|
13
22
|
@authenticated_for_specs if override_for_specs?
|
14
23
|
end
|
15
24
|
|
16
|
-
def
|
17
|
-
override_for_specs?
|
25
|
+
def spec_user_data
|
26
|
+
if override_for_specs?
|
27
|
+
@spec_user_data.presence || DEFAULT_SPEC_USER_DATA
|
28
|
+
else
|
29
|
+
DEFAULT_SPEC_USER_DATA
|
30
|
+
end
|
18
31
|
end
|
19
32
|
|
20
|
-
def
|
33
|
+
def override_for_specs?
|
21
34
|
Rails.env.test? && provide_authentication?
|
22
35
|
end
|
23
36
|
|
24
|
-
def
|
25
|
-
|
26
|
-
|
37
|
+
def authenticate_for_specs?
|
38
|
+
raise TEST_ENV_ERROR_MESSGE unless Rails.env.test?
|
39
|
+
|
40
|
+
provide_authentication?
|
41
|
+
end
|
42
|
+
|
43
|
+
def authenticate_for_specs(spec_user: nil, spec_user_data: {})
|
44
|
+
return unless authenticate_for_specs?
|
27
45
|
|
46
|
+
set_spec_user spec_user, spec_user_data
|
47
|
+
yield
|
48
|
+
reset_spec_user
|
49
|
+
end
|
50
|
+
|
51
|
+
def set_spec_user(spec_user, spec_user_data)
|
28
52
|
@authenticated_for_specs = true
|
29
53
|
@spec_user = spec_user
|
30
54
|
@spec_user_data = spec_user_data
|
31
|
-
|
32
|
-
|
33
|
-
|
55
|
+
end
|
56
|
+
|
57
|
+
def reset_spec_user
|
58
|
+
@spec_user_data = DEFAULT_SPEC_USER_DATA
|
59
|
+
@spec_user = nil
|
34
60
|
@authenticated_for_specs = false
|
61
|
+
nil
|
35
62
|
end
|
36
63
|
end
|
data/lib/oauth_im/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth_im
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Connally
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fusionauth_client
|