devise 3.5.8 → 3.5.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of devise might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +35 -31
- data/gemfiles/Gemfile.rails-3.2-stable.lock +42 -42
- data/gemfiles/Gemfile.rails-4.0-stable +1 -0
- data/gemfiles/Gemfile.rails-4.0-stable.lock +15 -12
- data/gemfiles/Gemfile.rails-4.1-stable +1 -0
- data/gemfiles/Gemfile.rails-4.1-stable.lock +56 -57
- data/gemfiles/Gemfile.rails-4.2-stable +1 -0
- data/gemfiles/Gemfile.rails-4.2-stable.lock +73 -74
- data/lib/devise/models/lockable.rb +5 -1
- data/lib/devise/version.rb +1 -1
- data/test/integration/rememberable_test.rb +5 -0
- data/test/models/lockable_test.rb +22 -0
- data/test/time_helpers.rb +137 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d465d9f22f681e03fef2dd593b47ced392d0b86
|
4
|
+
data.tar.gz: 77852e036ed596c2a81ca11bad4100f841047161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fab6f42ec4811171066f9a03f192857ecc4bbd17d656db65778ebb10e36f6988742a45cab11f4fdb600332212fd2da8e63164516e655893d84f35fd1da016f20
|
7
|
+
data.tar.gz: 493ce3480dfe5d314ebfc5b93c8660e9b34d9d8cbaa914a62f760359b9903d373cb4feafcda30cc9ead9416acf2441ffb6e8d2bce2a534b729e21956b27ab4f4
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
devise (3.5.
|
4
|
+
devise (3.5.9)
|
5
5
|
bcrypt (~> 3.0)
|
6
6
|
orm_adapter (~> 0.1)
|
7
7
|
railties (>= 3.2.6, < 5)
|
@@ -47,28 +47,29 @@ GEM
|
|
47
47
|
minitest (~> 5.1)
|
48
48
|
thread_safe (~> 0.3, >= 0.3.4)
|
49
49
|
tzinfo (~> 1.1)
|
50
|
-
arel (6.0.
|
50
|
+
arel (6.0.3)
|
51
51
|
bcrypt (3.1.11)
|
52
|
-
bson (3.
|
52
|
+
bson (3.2.6)
|
53
53
|
builder (3.2.2)
|
54
|
+
concurrent-ruby (1.0.1)
|
54
55
|
connection_pool (2.2.0)
|
55
56
|
erubis (2.7.0)
|
56
|
-
faraday (0.9.
|
57
|
+
faraday (0.9.2)
|
57
58
|
multipart-post (>= 1.2, < 3)
|
58
|
-
globalid (0.3.
|
59
|
+
globalid (0.3.6)
|
59
60
|
activesupport (>= 4.1.0)
|
60
|
-
hashie (3.4.
|
61
|
+
hashie (3.4.3)
|
61
62
|
i18n (0.7.0)
|
62
63
|
json (1.8.3)
|
63
|
-
jwt (1.4
|
64
|
-
loofah (2.0.
|
64
|
+
jwt (1.5.4)
|
65
|
+
loofah (2.0.3)
|
65
66
|
nokogiri (>= 1.5.9)
|
66
|
-
mail (2.6.
|
67
|
-
mime-types (>= 1.16, <
|
67
|
+
mail (2.6.4)
|
68
|
+
mime-types (>= 1.16, < 4)
|
68
69
|
metaclass (0.0.4)
|
69
|
-
mime-types (2.
|
70
|
-
|
71
|
-
minitest (5.
|
70
|
+
mime-types (2.99.1)
|
71
|
+
mini_portile2 (2.0.0)
|
72
|
+
minitest (5.8.4)
|
72
73
|
mocha (1.1.0)
|
73
74
|
metaclass (~> 0.0.1)
|
74
75
|
mongoid (4.0.2)
|
@@ -76,15 +77,15 @@ GEM
|
|
76
77
|
moped (~> 2.0.0)
|
77
78
|
origin (~> 2.1)
|
78
79
|
tzinfo (>= 0.3.37)
|
79
|
-
moped (2.0.
|
80
|
+
moped (2.0.7)
|
80
81
|
bson (~> 3.0)
|
81
82
|
connection_pool (~> 2.0)
|
82
83
|
optionable (~> 0.2.0)
|
83
|
-
multi_json (1.11.
|
84
|
+
multi_json (1.11.3)
|
84
85
|
multi_xml (0.5.5)
|
85
86
|
multipart-post (2.0.0)
|
86
|
-
nokogiri (1.6.
|
87
|
-
|
87
|
+
nokogiri (1.6.7.2)
|
88
|
+
mini_portile2 (~> 2.0.0.rc2)
|
88
89
|
oauth2 (0.9.4)
|
89
90
|
faraday (>= 0.8, < 0.10)
|
90
91
|
jwt (~> 1.0)
|
@@ -105,9 +106,9 @@ GEM
|
|
105
106
|
omniauth (~> 1.0)
|
106
107
|
rack-openid (~> 1.3.1)
|
107
108
|
optionable (0.2.0)
|
108
|
-
origin (2.
|
109
|
+
origin (2.2.0)
|
109
110
|
orm_adapter (0.5.0)
|
110
|
-
rack (1.6.
|
111
|
+
rack (1.6.4)
|
111
112
|
rack-openid (1.3.1)
|
112
113
|
rack (>= 1.1.0)
|
113
114
|
ruby-openid (>= 2.1.8)
|
@@ -126,29 +127,31 @@ GEM
|
|
126
127
|
sprockets-rails
|
127
128
|
rails-deprecated_sanitizer (1.0.3)
|
128
129
|
activesupport (>= 4.2.0.alpha)
|
129
|
-
rails-dom-testing (1.0.
|
130
|
+
rails-dom-testing (1.0.7)
|
130
131
|
activesupport (>= 4.2.0.beta, < 5.0)
|
131
132
|
nokogiri (~> 1.6.0)
|
132
133
|
rails-deprecated_sanitizer (>= 1.0.1)
|
133
|
-
rails-html-sanitizer (1.0.
|
134
|
+
rails-html-sanitizer (1.0.3)
|
134
135
|
loofah (~> 2.0)
|
135
136
|
railties (4.2.2)
|
136
137
|
actionpack (= 4.2.2)
|
137
138
|
activesupport (= 4.2.2)
|
138
139
|
rake (>= 0.8.7)
|
139
140
|
thor (>= 0.18.1, < 2.0)
|
140
|
-
rake (
|
141
|
-
rdoc (4.2.
|
142
|
-
|
141
|
+
rake (11.1.2)
|
142
|
+
rdoc (4.2.2)
|
143
|
+
json (~> 1.4)
|
144
|
+
responders (2.2.0)
|
143
145
|
railties (>= 4.2.0, < 5.1)
|
144
146
|
ruby-openid (2.7.0)
|
145
|
-
sprockets (3.
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
147
|
+
sprockets (3.6.0)
|
148
|
+
concurrent-ruby (~> 1.0)
|
149
|
+
rack (> 1, < 3)
|
150
|
+
sprockets-rails (3.0.4)
|
151
|
+
actionpack (>= 4.0)
|
152
|
+
activesupport (>= 4.0)
|
153
|
+
sprockets (>= 3.0.0)
|
154
|
+
sqlite3 (1.3.11)
|
152
155
|
thor (0.19.1)
|
153
156
|
thread_safe (0.3.5)
|
154
157
|
tzinfo (1.2.2)
|
@@ -168,6 +171,7 @@ DEPENDENCIES
|
|
168
171
|
activerecord-jdbcsqlite3-adapter
|
169
172
|
devise!
|
170
173
|
jruby-openssl
|
174
|
+
mime-types (~> 2.99)
|
171
175
|
mocha (~> 1.1)
|
172
176
|
mongoid (~> 4.0)
|
173
177
|
omniauth (~> 1.2.0)
|
@@ -1,14 +1,14 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/rails/rails.git
|
3
|
-
revision:
|
3
|
+
revision: f85bbed4cdc1bdfd1e0dbd97bce9db81e44cbd11
|
4
4
|
branch: 3-2-stable
|
5
5
|
specs:
|
6
|
-
actionmailer (3.2.
|
7
|
-
actionpack (= 3.2.
|
6
|
+
actionmailer (3.2.22.2)
|
7
|
+
actionpack (= 3.2.22.2)
|
8
8
|
mail (~> 2.5.4)
|
9
|
-
actionpack (3.2.
|
10
|
-
activemodel (= 3.2.
|
11
|
-
activesupport (= 3.2.
|
9
|
+
actionpack (3.2.22.2)
|
10
|
+
activemodel (= 3.2.22.2)
|
11
|
+
activesupport (= 3.2.22.2)
|
12
12
|
builder (~> 3.0.0)
|
13
13
|
erubis (~> 2.7.0)
|
14
14
|
journey (~> 1.0.4)
|
@@ -16,31 +16,31 @@ GIT
|
|
16
16
|
rack-cache (~> 1.2)
|
17
17
|
rack-test (~> 0.6.1)
|
18
18
|
sprockets (~> 2.2.1)
|
19
|
-
activemodel (3.2.
|
20
|
-
activesupport (= 3.2.
|
19
|
+
activemodel (3.2.22.2)
|
20
|
+
activesupport (= 3.2.22.2)
|
21
21
|
builder (~> 3.0.0)
|
22
|
-
activerecord (3.2.
|
23
|
-
activemodel (= 3.2.
|
24
|
-
activesupport (= 3.2.
|
22
|
+
activerecord (3.2.22.2)
|
23
|
+
activemodel (= 3.2.22.2)
|
24
|
+
activesupport (= 3.2.22.2)
|
25
25
|
arel (~> 3.0.2)
|
26
26
|
tzinfo (~> 0.3.29)
|
27
|
-
activeresource (3.2.
|
28
|
-
activemodel (= 3.2.
|
29
|
-
activesupport (= 3.2.
|
30
|
-
activesupport (3.2.
|
27
|
+
activeresource (3.2.22.2)
|
28
|
+
activemodel (= 3.2.22.2)
|
29
|
+
activesupport (= 3.2.22.2)
|
30
|
+
activesupport (3.2.22.2)
|
31
31
|
i18n (~> 0.6, >= 0.6.4)
|
32
32
|
multi_json (~> 1.0)
|
33
|
-
rails (3.2.
|
34
|
-
actionmailer (= 3.2.
|
35
|
-
actionpack (= 3.2.
|
36
|
-
activerecord (= 3.2.
|
37
|
-
activeresource (= 3.2.
|
38
|
-
activesupport (= 3.2.
|
33
|
+
rails (3.2.22.2)
|
34
|
+
actionmailer (= 3.2.22.2)
|
35
|
+
actionpack (= 3.2.22.2)
|
36
|
+
activerecord (= 3.2.22.2)
|
37
|
+
activeresource (= 3.2.22.2)
|
38
|
+
activesupport (= 3.2.22.2)
|
39
39
|
bundler (~> 1.0)
|
40
|
-
railties (= 3.2.
|
41
|
-
railties (3.2.
|
42
|
-
actionpack (= 3.2.
|
43
|
-
activesupport (= 3.2.
|
40
|
+
railties (= 3.2.22.2)
|
41
|
+
railties (3.2.22.2)
|
42
|
+
actionpack (= 3.2.22.2)
|
43
|
+
activesupport (= 3.2.22.2)
|
44
44
|
rack-ssl (~> 1.3.2)
|
45
45
|
rake (>= 0.8.7)
|
46
46
|
rdoc (~> 3.4)
|
@@ -49,7 +49,7 @@ GIT
|
|
49
49
|
PATH
|
50
50
|
remote: ..
|
51
51
|
specs:
|
52
|
-
devise (3.5.
|
52
|
+
devise (3.5.8)
|
53
53
|
bcrypt (~> 3.0)
|
54
54
|
orm_adapter (~> 0.1)
|
55
55
|
railties (>= 3.2.6, < 5)
|
@@ -61,36 +61,36 @@ GEM
|
|
61
61
|
remote: https://rubygems.org/
|
62
62
|
specs:
|
63
63
|
arel (3.0.3)
|
64
|
-
bcrypt (3.1.
|
64
|
+
bcrypt (3.1.11)
|
65
65
|
builder (3.0.4)
|
66
66
|
erubis (2.7.0)
|
67
|
-
faraday (0.9.
|
67
|
+
faraday (0.9.2)
|
68
68
|
multipart-post (>= 1.2, < 3)
|
69
|
-
hashie (3.4.
|
69
|
+
hashie (3.4.3)
|
70
70
|
hike (1.2.3)
|
71
71
|
i18n (0.7.0)
|
72
72
|
journey (1.0.4)
|
73
|
-
json (1.8.
|
74
|
-
jwt (1.4
|
73
|
+
json (1.8.3)
|
74
|
+
jwt (1.5.4)
|
75
75
|
mail (2.5.4)
|
76
76
|
mime-types (~> 1.16)
|
77
77
|
treetop (~> 1.4.8)
|
78
78
|
metaclass (0.0.4)
|
79
79
|
mime-types (1.25.1)
|
80
|
-
|
80
|
+
mini_portile2 (2.0.0)
|
81
81
|
mocha (1.1.0)
|
82
82
|
metaclass (~> 0.0.1)
|
83
|
-
mongoid (3.1.
|
83
|
+
mongoid (3.1.7)
|
84
84
|
activemodel (~> 3.2)
|
85
85
|
moped (~> 1.4)
|
86
86
|
origin (~> 1.0)
|
87
87
|
tzinfo (~> 0.3.29)
|
88
|
-
moped (1.5.
|
89
|
-
multi_json (1.11.
|
88
|
+
moped (1.5.3)
|
89
|
+
multi_json (1.11.3)
|
90
90
|
multi_xml (0.5.5)
|
91
91
|
multipart-post (2.0.0)
|
92
|
-
nokogiri (1.6.
|
93
|
-
|
92
|
+
nokogiri (1.6.7.2)
|
93
|
+
mini_portile2 (~> 2.0.0.rc2)
|
94
94
|
oauth2 (0.9.4)
|
95
95
|
faraday (>= 0.8, < 0.10)
|
96
96
|
jwt (~> 1.0)
|
@@ -113,8 +113,8 @@ GEM
|
|
113
113
|
origin (1.1.0)
|
114
114
|
orm_adapter (0.5.0)
|
115
115
|
polyglot (0.3.5)
|
116
|
-
rack (1.4.
|
117
|
-
rack-cache (1.
|
116
|
+
rack (1.4.7)
|
117
|
+
rack-cache (1.6.1)
|
118
118
|
rack (>= 0.4)
|
119
119
|
rack-openid (1.3.1)
|
120
120
|
rack (>= 1.1.0)
|
@@ -123,7 +123,7 @@ GEM
|
|
123
123
|
rack
|
124
124
|
rack-test (0.6.3)
|
125
125
|
rack (>= 1.0)
|
126
|
-
rake (
|
126
|
+
rake (11.1.2)
|
127
127
|
rdoc (3.12.2)
|
128
128
|
json (~> 1.4)
|
129
129
|
responders (1.1.2)
|
@@ -134,14 +134,14 @@ GEM
|
|
134
134
|
multi_json (~> 1.0)
|
135
135
|
rack (~> 1.0)
|
136
136
|
tilt (~> 1.1, != 1.3.0)
|
137
|
-
sqlite3 (1.3.
|
137
|
+
sqlite3 (1.3.11)
|
138
138
|
thor (0.19.1)
|
139
139
|
thread_safe (0.3.5)
|
140
140
|
tilt (1.4.1)
|
141
141
|
treetop (1.4.15)
|
142
142
|
polyglot
|
143
143
|
polyglot (>= 0.3.1)
|
144
|
-
tzinfo (0.3.
|
144
|
+
tzinfo (0.3.49)
|
145
145
|
warden (1.2.6)
|
146
146
|
rack (>= 1.0)
|
147
147
|
webrat (0.7.3)
|
@@ -43,7 +43,7 @@ GIT
|
|
43
43
|
PATH
|
44
44
|
remote: ..
|
45
45
|
specs:
|
46
|
-
devise (3.5.
|
46
|
+
devise (3.5.8)
|
47
47
|
bcrypt (~> 3.0)
|
48
48
|
orm_adapter (~> 0.1)
|
49
49
|
railties (>= 3.2.6, < 5)
|
@@ -56,21 +56,22 @@ GEM
|
|
56
56
|
specs:
|
57
57
|
activerecord-deprecated_finders (1.0.4)
|
58
58
|
arel (4.0.2)
|
59
|
-
bcrypt (3.1.
|
59
|
+
bcrypt (3.1.11)
|
60
60
|
bson (3.2.6)
|
61
61
|
builder (3.1.4)
|
62
|
-
concurrent-ruby (1.0.
|
62
|
+
concurrent-ruby (1.0.1)
|
63
63
|
connection_pool (2.2.0)
|
64
64
|
erubis (2.7.0)
|
65
65
|
faraday (0.9.2)
|
66
66
|
multipart-post (>= 1.2, < 3)
|
67
67
|
hashie (3.4.3)
|
68
68
|
i18n (0.7.0)
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
json (1.8.3)
|
70
|
+
jwt (1.5.4)
|
71
|
+
mail (2.6.4)
|
72
|
+
mime-types (>= 1.16, < 4)
|
72
73
|
metaclass (0.0.4)
|
73
|
-
mime-types (2.99)
|
74
|
+
mime-types (2.99.1)
|
74
75
|
mini_portile2 (2.0.0)
|
75
76
|
minitest (4.7.5)
|
76
77
|
mocha (1.1.0)
|
@@ -84,7 +85,7 @@ GEM
|
|
84
85
|
bson (~> 3.0)
|
85
86
|
connection_pool (~> 2.0)
|
86
87
|
optionable (~> 0.2.0)
|
87
|
-
multi_json (1.11.
|
88
|
+
multi_json (1.11.3)
|
88
89
|
multi_xml (0.5.5)
|
89
90
|
multipart-post (2.0.0)
|
90
91
|
nokogiri (1.6.7.2)
|
@@ -117,12 +118,13 @@ GEM
|
|
117
118
|
ruby-openid (>= 2.1.8)
|
118
119
|
rack-test (0.6.3)
|
119
120
|
rack (>= 1.0)
|
120
|
-
rake (
|
121
|
-
rdoc (4.2.
|
121
|
+
rake (11.1.2)
|
122
|
+
rdoc (4.2.2)
|
123
|
+
json (~> 1.4)
|
122
124
|
responders (1.1.2)
|
123
125
|
railties (>= 3.2, < 4.2)
|
124
126
|
ruby-openid (2.7.0)
|
125
|
-
sprockets (3.
|
127
|
+
sprockets (3.6.0)
|
126
128
|
concurrent-ruby (~> 1.0)
|
127
129
|
rack (> 1, < 3)
|
128
130
|
sprockets-rails (2.3.3)
|
@@ -132,7 +134,7 @@ GEM
|
|
132
134
|
sqlite3 (1.3.11)
|
133
135
|
thor (0.19.1)
|
134
136
|
thread_safe (0.3.5)
|
135
|
-
tzinfo (0.3.
|
137
|
+
tzinfo (0.3.49)
|
136
138
|
warden (1.2.6)
|
137
139
|
rack (>= 1.0)
|
138
140
|
webrat (0.7.3)
|
@@ -148,6 +150,7 @@ DEPENDENCIES
|
|
148
150
|
activerecord-jdbcsqlite3-adapter
|
149
151
|
devise!
|
150
152
|
jruby-openssl
|
153
|
+
mime-types (~> 2.99)
|
151
154
|
mocha (~> 1.1)
|
152
155
|
mongoid (~> 4.0.0)
|
153
156
|
omniauth (~> 1.2.0)
|
@@ -1,54 +1,54 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/rails/rails.git
|
3
|
-
revision:
|
3
|
+
revision: 41b4d81b4fd14cbf43060c223bea0f461256d099
|
4
4
|
branch: 4-1-stable
|
5
5
|
specs:
|
6
|
-
actionmailer (4.1.
|
7
|
-
actionpack (= 4.1.
|
8
|
-
actionview (= 4.1.
|
6
|
+
actionmailer (4.1.15)
|
7
|
+
actionpack (= 4.1.15)
|
8
|
+
actionview (= 4.1.15)
|
9
9
|
mail (~> 2.5, >= 2.5.4)
|
10
|
-
actionpack (4.1.
|
11
|
-
actionview (= 4.1.
|
12
|
-
activesupport (= 4.1.
|
10
|
+
actionpack (4.1.15)
|
11
|
+
actionview (= 4.1.15)
|
12
|
+
activesupport (= 4.1.15)
|
13
13
|
rack (~> 1.5.2)
|
14
14
|
rack-test (~> 0.6.2)
|
15
|
-
actionview (4.1.
|
16
|
-
activesupport (= 4.1.
|
15
|
+
actionview (4.1.15)
|
16
|
+
activesupport (= 4.1.15)
|
17
17
|
builder (~> 3.1)
|
18
18
|
erubis (~> 2.7.0)
|
19
|
-
activemodel (4.1.
|
20
|
-
activesupport (= 4.1.
|
19
|
+
activemodel (4.1.15)
|
20
|
+
activesupport (= 4.1.15)
|
21
21
|
builder (~> 3.1)
|
22
|
-
activerecord (4.1.
|
23
|
-
activemodel (= 4.1.
|
24
|
-
activesupport (= 4.1.
|
22
|
+
activerecord (4.1.15)
|
23
|
+
activemodel (= 4.1.15)
|
24
|
+
activesupport (= 4.1.15)
|
25
25
|
arel (~> 5.0.0)
|
26
|
-
activesupport (4.1.
|
26
|
+
activesupport (4.1.15)
|
27
27
|
i18n (~> 0.6, >= 0.6.9)
|
28
28
|
json (~> 1.7, >= 1.7.7)
|
29
29
|
minitest (~> 5.1)
|
30
30
|
thread_safe (~> 0.1)
|
31
31
|
tzinfo (~> 1.1)
|
32
|
-
rails (4.1.
|
33
|
-
actionmailer (= 4.1.
|
34
|
-
actionpack (= 4.1.
|
35
|
-
actionview (= 4.1.
|
36
|
-
activemodel (= 4.1.
|
37
|
-
activerecord (= 4.1.
|
38
|
-
activesupport (= 4.1.
|
32
|
+
rails (4.1.15)
|
33
|
+
actionmailer (= 4.1.15)
|
34
|
+
actionpack (= 4.1.15)
|
35
|
+
actionview (= 4.1.15)
|
36
|
+
activemodel (= 4.1.15)
|
37
|
+
activerecord (= 4.1.15)
|
38
|
+
activesupport (= 4.1.15)
|
39
39
|
bundler (>= 1.3.0, < 2.0)
|
40
|
-
railties (= 4.1.
|
40
|
+
railties (= 4.1.15)
|
41
41
|
sprockets-rails (~> 2.0)
|
42
|
-
railties (4.1.
|
43
|
-
actionpack (= 4.1.
|
44
|
-
activesupport (= 4.1.
|
42
|
+
railties (4.1.15)
|
43
|
+
actionpack (= 4.1.15)
|
44
|
+
activesupport (= 4.1.15)
|
45
45
|
rake (>= 0.8.7)
|
46
46
|
thor (>= 0.18.1, < 2.0)
|
47
47
|
|
48
48
|
PATH
|
49
49
|
remote: ..
|
50
50
|
specs:
|
51
|
-
devise (3.5.
|
51
|
+
devise (3.5.8)
|
52
52
|
bcrypt (~> 3.0)
|
53
53
|
orm_adapter (~> 0.1)
|
54
54
|
railties (>= 3.2.6, < 5)
|
@@ -60,24 +60,24 @@ GEM
|
|
60
60
|
remote: https://rubygems.org/
|
61
61
|
specs:
|
62
62
|
arel (5.0.1.20140414130214)
|
63
|
-
bcrypt (3.1.
|
64
|
-
bson (2.
|
63
|
+
bcrypt (3.1.11)
|
64
|
+
bson (3.2.6)
|
65
65
|
builder (3.2.2)
|
66
|
-
|
66
|
+
concurrent-ruby (1.0.1)
|
67
|
+
connection_pool (2.2.0)
|
67
68
|
erubis (2.7.0)
|
68
|
-
faraday (0.9.
|
69
|
+
faraday (0.9.2)
|
69
70
|
multipart-post (>= 1.2, < 3)
|
70
|
-
hashie (3.4.
|
71
|
-
hike (1.2.3)
|
71
|
+
hashie (3.4.3)
|
72
72
|
i18n (0.7.0)
|
73
|
-
json (1.8.
|
74
|
-
jwt (1.4
|
75
|
-
mail (2.6.
|
76
|
-
mime-types (>= 1.16, <
|
73
|
+
json (1.8.3)
|
74
|
+
jwt (1.5.4)
|
75
|
+
mail (2.6.4)
|
76
|
+
mime-types (>= 1.16, < 4)
|
77
77
|
metaclass (0.0.4)
|
78
|
-
mime-types (2.
|
79
|
-
|
80
|
-
minitest (5.
|
78
|
+
mime-types (2.99.1)
|
79
|
+
mini_portile2 (2.0.0)
|
80
|
+
minitest (5.8.4)
|
81
81
|
mocha (1.1.0)
|
82
82
|
metaclass (~> 0.0.1)
|
83
83
|
mongoid (4.0.2)
|
@@ -85,15 +85,15 @@ GEM
|
|
85
85
|
moped (~> 2.0.0)
|
86
86
|
origin (~> 2.1)
|
87
87
|
tzinfo (>= 0.3.37)
|
88
|
-
moped (2.0.
|
89
|
-
bson (~>
|
88
|
+
moped (2.0.7)
|
89
|
+
bson (~> 3.0)
|
90
90
|
connection_pool (~> 2.0)
|
91
91
|
optionable (~> 0.2.0)
|
92
|
-
multi_json (1.11.
|
92
|
+
multi_json (1.11.3)
|
93
93
|
multi_xml (0.5.5)
|
94
94
|
multipart-post (2.0.0)
|
95
|
-
nokogiri (1.6.
|
96
|
-
|
95
|
+
nokogiri (1.6.7.2)
|
96
|
+
mini_portile2 (~> 2.0.0.rc2)
|
97
97
|
oauth2 (0.9.4)
|
98
98
|
faraday (>= 0.8, < 0.10)
|
99
99
|
jwt (~> 1.0)
|
@@ -114,32 +114,30 @@ GEM
|
|
114
114
|
omniauth (~> 1.0)
|
115
115
|
rack-openid (~> 1.3.1)
|
116
116
|
optionable (0.2.0)
|
117
|
-
origin (2.
|
117
|
+
origin (2.2.0)
|
118
118
|
orm_adapter (0.5.0)
|
119
|
-
rack (1.5.
|
119
|
+
rack (1.5.5)
|
120
120
|
rack-openid (1.3.1)
|
121
121
|
rack (>= 1.1.0)
|
122
122
|
ruby-openid (>= 2.1.8)
|
123
123
|
rack-test (0.6.3)
|
124
124
|
rack (>= 1.0)
|
125
|
-
rake (
|
126
|
-
rdoc (4.2.
|
125
|
+
rake (11.1.2)
|
126
|
+
rdoc (4.2.2)
|
127
|
+
json (~> 1.4)
|
127
128
|
responders (1.1.2)
|
128
129
|
railties (>= 3.2, < 4.2)
|
129
130
|
ruby-openid (2.7.0)
|
130
|
-
sprockets (
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
tilt (~> 1.1, != 1.3.0)
|
135
|
-
sprockets-rails (2.2.4)
|
131
|
+
sprockets (3.6.0)
|
132
|
+
concurrent-ruby (~> 1.0)
|
133
|
+
rack (> 1, < 3)
|
134
|
+
sprockets-rails (2.3.3)
|
136
135
|
actionpack (>= 3.0)
|
137
136
|
activesupport (>= 3.0)
|
138
137
|
sprockets (>= 2.8, < 4.0)
|
139
|
-
sqlite3 (1.3.
|
138
|
+
sqlite3 (1.3.11)
|
140
139
|
thor (0.19.1)
|
141
140
|
thread_safe (0.3.5)
|
142
|
-
tilt (1.4.1)
|
143
141
|
tzinfo (1.2.2)
|
144
142
|
thread_safe (~> 0.1)
|
145
143
|
warden (1.2.6)
|
@@ -157,6 +155,7 @@ DEPENDENCIES
|
|
157
155
|
activerecord-jdbcsqlite3-adapter
|
158
156
|
devise!
|
159
157
|
jruby-openssl
|
158
|
+
mime-types (~> 2.99)
|
160
159
|
mocha (~> 1.1)
|
161
160
|
mongoid (~> 4.0.0)
|
162
161
|
omniauth (~> 1.2.0)
|
@@ -1,64 +1,64 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/rails/rails.git
|
3
|
-
revision:
|
3
|
+
revision: 2a1b655bb7db42ed0dbadab5bb129a8515e86a40
|
4
4
|
branch: 4-2-stable
|
5
5
|
specs:
|
6
|
-
actionmailer (4.2.
|
7
|
-
actionpack (= 4.2.
|
8
|
-
actionview (= 4.2.
|
9
|
-
activejob (= 4.2.
|
6
|
+
actionmailer (4.2.6)
|
7
|
+
actionpack (= 4.2.6)
|
8
|
+
actionview (= 4.2.6)
|
9
|
+
activejob (= 4.2.6)
|
10
10
|
mail (~> 2.5, >= 2.5.4)
|
11
11
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
12
|
-
actionpack (4.2.
|
13
|
-
actionview (= 4.2.
|
14
|
-
activesupport (= 4.2.
|
12
|
+
actionpack (4.2.6)
|
13
|
+
actionview (= 4.2.6)
|
14
|
+
activesupport (= 4.2.6)
|
15
15
|
rack (~> 1.6)
|
16
16
|
rack-test (~> 0.6.2)
|
17
17
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
18
18
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
19
|
-
actionview (4.2.
|
20
|
-
activesupport (= 4.2.
|
19
|
+
actionview (4.2.6)
|
20
|
+
activesupport (= 4.2.6)
|
21
21
|
builder (~> 3.1)
|
22
22
|
erubis (~> 2.7.0)
|
23
23
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
24
24
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
25
|
-
activejob (4.2.
|
26
|
-
activesupport (= 4.2.
|
25
|
+
activejob (4.2.6)
|
26
|
+
activesupport (= 4.2.6)
|
27
27
|
globalid (>= 0.3.0)
|
28
|
-
activemodel (4.2.
|
29
|
-
activesupport (= 4.2.
|
28
|
+
activemodel (4.2.6)
|
29
|
+
activesupport (= 4.2.6)
|
30
30
|
builder (~> 3.1)
|
31
|
-
activerecord (4.2.
|
32
|
-
activemodel (= 4.2.
|
33
|
-
activesupport (= 4.2.
|
31
|
+
activerecord (4.2.6)
|
32
|
+
activemodel (= 4.2.6)
|
33
|
+
activesupport (= 4.2.6)
|
34
34
|
arel (~> 6.0)
|
35
|
-
activesupport (4.2.
|
35
|
+
activesupport (4.2.6)
|
36
36
|
i18n (~> 0.7)
|
37
37
|
json (~> 1.7, >= 1.7.7)
|
38
38
|
minitest (~> 5.1)
|
39
39
|
thread_safe (~> 0.3, >= 0.3.4)
|
40
40
|
tzinfo (~> 1.1)
|
41
|
-
rails (4.2.
|
42
|
-
actionmailer (= 4.2.
|
43
|
-
actionpack (= 4.2.
|
44
|
-
actionview (= 4.2.
|
45
|
-
activejob (= 4.2.
|
46
|
-
activemodel (= 4.2.
|
47
|
-
activerecord (= 4.2.
|
48
|
-
activesupport (= 4.2.
|
41
|
+
rails (4.2.6)
|
42
|
+
actionmailer (= 4.2.6)
|
43
|
+
actionpack (= 4.2.6)
|
44
|
+
actionview (= 4.2.6)
|
45
|
+
activejob (= 4.2.6)
|
46
|
+
activemodel (= 4.2.6)
|
47
|
+
activerecord (= 4.2.6)
|
48
|
+
activesupport (= 4.2.6)
|
49
49
|
bundler (>= 1.3.0, < 2.0)
|
50
|
-
railties (= 4.2.
|
50
|
+
railties (= 4.2.6)
|
51
51
|
sprockets-rails
|
52
|
-
railties (4.2.
|
53
|
-
actionpack (= 4.2.
|
54
|
-
activesupport (= 4.2.
|
52
|
+
railties (4.2.6)
|
53
|
+
actionpack (= 4.2.6)
|
54
|
+
activesupport (= 4.2.6)
|
55
55
|
rake (>= 0.8.7)
|
56
56
|
thor (>= 0.18.1, < 2.0)
|
57
57
|
|
58
58
|
PATH
|
59
59
|
remote: ..
|
60
60
|
specs:
|
61
|
-
devise (3.5.
|
61
|
+
devise (3.5.8)
|
62
62
|
bcrypt (~> 3.0)
|
63
63
|
orm_adapter (~> 0.1)
|
64
64
|
railties (>= 3.2.6, < 5)
|
@@ -69,29 +69,29 @@ PATH
|
|
69
69
|
GEM
|
70
70
|
remote: https://rubygems.org/
|
71
71
|
specs:
|
72
|
-
arel (6.0.
|
73
|
-
bcrypt (3.1.
|
74
|
-
bson (2.
|
72
|
+
arel (6.0.3)
|
73
|
+
bcrypt (3.1.11)
|
74
|
+
bson (3.2.6)
|
75
75
|
builder (3.2.2)
|
76
|
-
|
76
|
+
concurrent-ruby (1.0.1)
|
77
|
+
connection_pool (2.2.0)
|
77
78
|
erubis (2.7.0)
|
78
|
-
faraday (0.9.
|
79
|
+
faraday (0.9.2)
|
79
80
|
multipart-post (>= 1.2, < 3)
|
80
|
-
globalid (0.3.
|
81
|
+
globalid (0.3.6)
|
81
82
|
activesupport (>= 4.1.0)
|
82
|
-
hashie (3.4.
|
83
|
-
hike (1.2.3)
|
83
|
+
hashie (3.4.3)
|
84
84
|
i18n (0.7.0)
|
85
|
-
json (1.8.
|
86
|
-
jwt (1.
|
87
|
-
loofah (2.0.
|
85
|
+
json (1.8.3)
|
86
|
+
jwt (1.5.1)
|
87
|
+
loofah (2.0.3)
|
88
88
|
nokogiri (>= 1.5.9)
|
89
|
-
mail (2.6.
|
90
|
-
mime-types (>= 1.16, <
|
89
|
+
mail (2.6.4)
|
90
|
+
mime-types (>= 1.16, < 4)
|
91
91
|
metaclass (0.0.4)
|
92
|
-
mime-types (2.
|
93
|
-
|
94
|
-
minitest (5.
|
92
|
+
mime-types (2.99.1)
|
93
|
+
mini_portile2 (2.0.0)
|
94
|
+
minitest (5.8.4)
|
95
95
|
mocha (1.1.0)
|
96
96
|
metaclass (~> 0.0.1)
|
97
97
|
mongoid (4.0.2)
|
@@ -99,25 +99,25 @@ GEM
|
|
99
99
|
moped (~> 2.0.0)
|
100
100
|
origin (~> 2.1)
|
101
101
|
tzinfo (>= 0.3.37)
|
102
|
-
moped (2.0.
|
103
|
-
bson (~>
|
102
|
+
moped (2.0.7)
|
103
|
+
bson (~> 3.0)
|
104
104
|
connection_pool (~> 2.0)
|
105
105
|
optionable (~> 0.2.0)
|
106
|
-
multi_json (1.11.
|
106
|
+
multi_json (1.11.3)
|
107
107
|
multi_xml (0.5.5)
|
108
108
|
multipart-post (2.0.0)
|
109
|
-
nokogiri (1.6.
|
110
|
-
|
111
|
-
oauth2 (1.
|
109
|
+
nokogiri (1.6.7.2)
|
110
|
+
mini_portile2 (~> 2.0.0.rc2)
|
111
|
+
oauth2 (1.1.0)
|
112
112
|
faraday (>= 0.8, < 0.10)
|
113
|
-
jwt (~> 1.0)
|
113
|
+
jwt (~> 1.0, < 1.5.2)
|
114
114
|
multi_json (~> 1.3)
|
115
115
|
multi_xml (~> 0.5)
|
116
|
-
rack (
|
116
|
+
rack (>= 1.2, < 3)
|
117
117
|
omniauth (1.2.2)
|
118
118
|
hashie (>= 1.2, < 4)
|
119
119
|
rack (~> 1.0)
|
120
|
-
omniauth-facebook (
|
120
|
+
omniauth-facebook (3.0.0)
|
121
121
|
omniauth-oauth2 (~> 1.2)
|
122
122
|
omniauth-oauth2 (1.2.0)
|
123
123
|
faraday (>= 0.8, < 0.10)
|
@@ -128,9 +128,9 @@ GEM
|
|
128
128
|
omniauth (~> 1.0)
|
129
129
|
rack-openid (~> 1.3.1)
|
130
130
|
optionable (0.2.0)
|
131
|
-
origin (2.
|
131
|
+
origin (2.2.0)
|
132
132
|
orm_adapter (0.5.0)
|
133
|
-
rack (1.6.
|
133
|
+
rack (1.6.4)
|
134
134
|
rack-openid (1.3.1)
|
135
135
|
rack (>= 1.1.0)
|
136
136
|
ruby-openid (>= 2.1.8)
|
@@ -138,30 +138,28 @@ GEM
|
|
138
138
|
rack (>= 1.0)
|
139
139
|
rails-deprecated_sanitizer (1.0.3)
|
140
140
|
activesupport (>= 4.2.0.alpha)
|
141
|
-
rails-dom-testing (1.0.
|
141
|
+
rails-dom-testing (1.0.7)
|
142
142
|
activesupport (>= 4.2.0.beta, < 5.0)
|
143
143
|
nokogiri (~> 1.6.0)
|
144
144
|
rails-deprecated_sanitizer (>= 1.0.1)
|
145
|
-
rails-html-sanitizer (1.0.
|
145
|
+
rails-html-sanitizer (1.0.3)
|
146
146
|
loofah (~> 2.0)
|
147
|
-
rake (
|
148
|
-
rdoc (4.2.
|
149
|
-
|
147
|
+
rake (11.1.2)
|
148
|
+
rdoc (4.2.2)
|
149
|
+
json (~> 1.4)
|
150
|
+
responders (2.1.2)
|
150
151
|
railties (>= 4.2.0, < 5.1)
|
151
152
|
ruby-openid (2.7.0)
|
152
|
-
sprockets (
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
sprockets (>= 2.8, < 4.0)
|
161
|
-
sqlite3 (1.3.10)
|
153
|
+
sprockets (3.6.0)
|
154
|
+
concurrent-ruby (~> 1.0)
|
155
|
+
rack (> 1, < 3)
|
156
|
+
sprockets-rails (3.0.4)
|
157
|
+
actionpack (>= 4.0)
|
158
|
+
activesupport (>= 4.0)
|
159
|
+
sprockets (>= 3.0.0)
|
160
|
+
sqlite3 (1.3.11)
|
162
161
|
thor (0.19.1)
|
163
162
|
thread_safe (0.3.5)
|
164
|
-
tilt (1.4.1)
|
165
163
|
tzinfo (1.2.2)
|
166
164
|
thread_safe (~> 0.1)
|
167
165
|
warden (1.2.6)
|
@@ -179,6 +177,7 @@ DEPENDENCIES
|
|
179
177
|
activerecord-jdbcsqlite3-adapter
|
180
178
|
devise!
|
181
179
|
jruby-openssl
|
180
|
+
mime-types (~> 2.99)
|
182
181
|
mocha (~> 1.1)
|
183
182
|
mongoid (~> 4.0.0)
|
184
183
|
omniauth (~> 1.2.2)
|
@@ -155,6 +155,9 @@ module Devise
|
|
155
155
|
end
|
156
156
|
|
157
157
|
module ClassMethods
|
158
|
+
# List of strategies that are enabled/supported if :both is used.
|
159
|
+
BOTH_STRATEGIES = [:time, :email]
|
160
|
+
|
158
161
|
# Attempt to find a user by its unlock keys. If a record is found, send new
|
159
162
|
# unlock instructions to it. If not user is found, returns a new user
|
160
163
|
# with an email not found error.
|
@@ -181,7 +184,8 @@ module Devise
|
|
181
184
|
|
182
185
|
# Is the unlock enabled for the given unlock strategy?
|
183
186
|
def unlock_strategy_enabled?(strategy)
|
184
|
-
|
187
|
+
self.unlock_strategy == strategy ||
|
188
|
+
(self.unlock_strategy == :both && BOTH_STRATEGIES.include?(strategy))
|
185
189
|
end
|
186
190
|
|
187
191
|
# Is the lock enabled for the given lock strategy?
|
data/lib/devise/version.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class RememberMeTest < ActionDispatch::IntegrationTest
|
4
|
+
if (Rails::VERSION::MAJOR < 4) || (Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR < 1)
|
5
|
+
require 'time_helpers'
|
6
|
+
include ActiveSupport::Testing::TimeHelpers
|
7
|
+
end
|
8
|
+
|
4
9
|
def create_user_and_remember(add_to_token='')
|
5
10
|
user = create_user
|
6
11
|
user.remember_me!
|
@@ -325,4 +325,26 @@ class LockableTest < ActiveSupport::TestCase
|
|
325
325
|
user.lock_access!
|
326
326
|
assert_equal :locked, user.unauthenticated_message
|
327
327
|
end
|
328
|
+
|
329
|
+
test 'unlock_strategy_enabled? should return true for both, email, and time strategies if :both is used' do
|
330
|
+
swap Devise, unlock_strategy: :both do
|
331
|
+
user = create_user
|
332
|
+
assert_equal true, user.unlock_strategy_enabled?(:both)
|
333
|
+
assert_equal true, user.unlock_strategy_enabled?(:time)
|
334
|
+
assert_equal true, user.unlock_strategy_enabled?(:email)
|
335
|
+
assert_equal false, user.unlock_strategy_enabled?(:none)
|
336
|
+
assert_equal false, user.unlock_strategy_enabled?(:an_undefined_strategy)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
test 'unlock_strategy_enabled? should return true only for the configured strategy' do
|
341
|
+
swap Devise, unlock_strategy: :email do
|
342
|
+
user = create_user
|
343
|
+
assert_equal false, user.unlock_strategy_enabled?(:both)
|
344
|
+
assert_equal false, user.unlock_strategy_enabled?(:time)
|
345
|
+
assert_equal true, user.unlock_strategy_enabled?(:email)
|
346
|
+
assert_equal false, user.unlock_strategy_enabled?(:none)
|
347
|
+
assert_equal false, user.unlock_strategy_enabled?(:an_undefined_strategy)
|
348
|
+
end
|
349
|
+
end
|
328
350
|
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# A copy of Rails time helpers. With this file we can support the `travel_to`
|
2
|
+
# helper for Rails versions prior 4.1.
|
3
|
+
# File origin: https://github.com/rails/rails/blob/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1/activesupport/lib/active_support/testing/time_helpers.rb
|
4
|
+
module ActiveSupport
|
5
|
+
module Testing
|
6
|
+
class SimpleStubs # :nodoc:
|
7
|
+
Stub = Struct.new(:object, :method_name, :original_method)
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@stubs = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def stub_object(object, method_name, return_value)
|
14
|
+
key = [object.object_id, method_name]
|
15
|
+
|
16
|
+
if stub = @stubs[key]
|
17
|
+
unstub_object(stub)
|
18
|
+
end
|
19
|
+
|
20
|
+
new_name = "__simple_stub__#{method_name}"
|
21
|
+
|
22
|
+
@stubs[key] = Stub.new(object, method_name, new_name)
|
23
|
+
|
24
|
+
object.singleton_class.send :alias_method, new_name, method_name
|
25
|
+
object.define_singleton_method(method_name) { return_value }
|
26
|
+
end
|
27
|
+
|
28
|
+
def unstub_all!
|
29
|
+
@stubs.each_value do |stub|
|
30
|
+
unstub_object(stub)
|
31
|
+
end
|
32
|
+
@stubs = {}
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def unstub_object(stub)
|
38
|
+
singleton_class = stub.object.singleton_class
|
39
|
+
singleton_class.send :undef_method, stub.method_name
|
40
|
+
singleton_class.send :alias_method, stub.method_name, stub.original_method
|
41
|
+
singleton_class.send :undef_method, stub.original_method
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Contains helpers that help you test passage of time.
|
46
|
+
module TimeHelpers
|
47
|
+
# Changes current time to the time in the future or in the past by a given time difference by
|
48
|
+
# stubbing +Time.now+, +Date.today+, and +DateTime.now+.
|
49
|
+
#
|
50
|
+
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
51
|
+
# travel 1.day
|
52
|
+
# Time.current # => Sun, 10 Nov 2013 15:34:49 EST -05:00
|
53
|
+
# Date.current # => Sun, 10 Nov 2013
|
54
|
+
# DateTime.current # => Sun, 10 Nov 2013 15:34:49 -0500
|
55
|
+
#
|
56
|
+
# This method also accepts a block, which will return the current time back to its original
|
57
|
+
# state at the end of the block:
|
58
|
+
#
|
59
|
+
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
60
|
+
# travel 1.day do
|
61
|
+
# User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00
|
62
|
+
# end
|
63
|
+
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
64
|
+
def travel(duration, &block)
|
65
|
+
travel_to Time.now + duration, &block
|
66
|
+
end
|
67
|
+
|
68
|
+
# Changes current time to the given time by stubbing +Time.now+,
|
69
|
+
# +Date.today+, and +DateTime.now+ to return the time or date passed into this method.
|
70
|
+
#
|
71
|
+
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
72
|
+
# travel_to Time.new(2004, 11, 24, 01, 04, 44)
|
73
|
+
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
|
74
|
+
# Date.current # => Wed, 24 Nov 2004
|
75
|
+
# DateTime.current # => Wed, 24 Nov 2004 01:04:44 -0500
|
76
|
+
#
|
77
|
+
# Dates are taken as their timestamp at the beginning of the day in the
|
78
|
+
# application time zone. <tt>Time.current</tt> returns said timestamp,
|
79
|
+
# and <tt>Time.now</tt> its equivalent in the system time zone. Similarly,
|
80
|
+
# <tt>Date.current</tt> returns a date equal to the argument, and
|
81
|
+
# <tt>Date.today</tt> the date according to <tt>Time.now</tt>, which may
|
82
|
+
# be different. (Note that you rarely want to deal with <tt>Time.now</tt>,
|
83
|
+
# or <tt>Date.today</tt>, in order to honor the application time zone
|
84
|
+
# please always use <tt>Time.current</tt> and <tt>Date.current</tt>.)
|
85
|
+
#
|
86
|
+
# Note that the usec for the time passed will be set to 0 to prevent rounding
|
87
|
+
# errors with external services, like MySQL (which will round instead of floor,
|
88
|
+
# leading to off-by-one-second errors).
|
89
|
+
#
|
90
|
+
# This method also accepts a block, which will return the current time back to its original
|
91
|
+
# state at the end of the block:
|
92
|
+
#
|
93
|
+
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
94
|
+
# travel_to Time.new(2004, 11, 24, 01, 04, 44) do
|
95
|
+
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
|
96
|
+
# end
|
97
|
+
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
98
|
+
def travel_to(date_or_time)
|
99
|
+
if date_or_time.is_a?(Date) && !date_or_time.is_a?(DateTime)
|
100
|
+
now = date_or_time.midnight.to_time
|
101
|
+
else
|
102
|
+
now = date_or_time.to_time.change(usec: 0)
|
103
|
+
end
|
104
|
+
|
105
|
+
simple_stubs.stub_object(Time, :now, now)
|
106
|
+
simple_stubs.stub_object(Date, :today, now.to_date)
|
107
|
+
simple_stubs.stub_object(DateTime, :now, now.to_datetime)
|
108
|
+
|
109
|
+
if block_given?
|
110
|
+
begin
|
111
|
+
yield
|
112
|
+
ensure
|
113
|
+
travel_back
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# Returns the current time back to its original state, by removing the stubs added by
|
119
|
+
# `travel` and `travel_to`.
|
120
|
+
#
|
121
|
+
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
122
|
+
# travel_to Time.new(2004, 11, 24, 01, 04, 44)
|
123
|
+
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
|
124
|
+
# travel_back
|
125
|
+
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
126
|
+
def travel_back
|
127
|
+
simple_stubs.unstub_all!
|
128
|
+
end
|
129
|
+
|
130
|
+
private
|
131
|
+
|
132
|
+
def simple_stubs
|
133
|
+
@simple_stubs ||= SimpleStubs.new
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: warden
|
@@ -363,6 +363,7 @@ files:
|
|
363
363
|
- test/test_helper.rb
|
364
364
|
- test/test_helpers_test.rb
|
365
365
|
- test/test_models.rb
|
366
|
+
- test/time_helpers.rb
|
366
367
|
homepage: https://github.com/plataformatec/devise
|
367
368
|
licenses:
|
368
369
|
- MIT
|
@@ -519,3 +520,4 @@ test_files:
|
|
519
520
|
- test/test_helper.rb
|
520
521
|
- test/test_helpers_test.rb
|
521
522
|
- test/test_models.rb
|
523
|
+
- test/time_helpers.rb
|