This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit 01f380b
1 parent f597b3b commit 01f380b Copy full SHA for 01f380b
File tree 2 files changed +22
-23
lines changed
2 files changed +22
-23
lines changed Original file line number Diff line number Diff line change 82
82
require Rails . root . join ( 'config' , 'initializers' , 'active_record_observer_hooks' )
83
83
# see comments in this file for more info
84
84
85
+ # Common login-testing strategies in the specs
86
+ #
87
+ if Squash ::Configuration . authentication . strategy == 'google'
88
+ RSpec . shared_context "setup for required logged-in user" do
89
+ unless Squash ::Configuration . authentication . strategy == 'google'
90
+ def login_required_redirection_url ( *args )
91
+ login_url ( *args )
92
+ end
93
+
94
+ else
95
+ before :each do
96
+ allow ( SecureRandom ) . to receive ( :hex ) . and_return ( '1234' )
97
+ end
98
+
99
+ def login_required_redirection_url ( *args )
100
+ controller . instance_eval { google_authentication_uri }
101
+ end
102
+ end
103
+
104
+ end
105
+ end
106
+
85
107
# Logs a user in for spec purposes.
86
108
#
87
109
# @params [User] user A user.
Original file line number Diff line number Diff line change 24
24
# individual file that may not need all of that loaded. Instead, consider making
25
25
# a separate helper file that requires the additional dependencies and performs
26
26
# the additional setup, and require it from the spec files that actually need it.
27
- # Common login-testing strategies in the specs
28
- #
29
- # @param [*args] Args to pass to #get
30
- if Squash ::Configuration . authentication . strategy == 'google'
31
- RSpec . shared_context "setup for required logged-in user" do
32
- unless Squash ::Configuration . authentication . strategy == 'google'
33
- def login_required_redirection_url ( *args )
34
- login_url ( *args )
35
- end
36
-
37
- else
38
- before :each do
39
- allow ( SecureRandom ) . to receive ( :hex ) . and_return ( '1234' )
40
- end
41
-
42
- def login_required_redirection_url ( *args )
43
- controller . instance_eval { google_authentication_uri }
44
- end
45
- end
46
-
47
- end
48
- end
49
-
50
27
#
51
28
# The `.rspec` file also contains a few flags that are not defaults but that
52
29
# users commonly want.
You can’t perform that action at this time.
0 commit comments