sorcery 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sorcery might be problematic. Click here for more details.

Files changed (31) hide show
  1. data/.travis.yml +2 -0
  2. data/Gemfile +2 -21
  3. data/Gemfile.lock +86 -52
  4. data/README.rdoc +4 -3
  5. data/VERSION +1 -1
  6. data/lib/generators/sorcery/install_generator.rb +6 -4
  7. data/lib/generators/sorcery/templates/initializer.rb +293 -127
  8. data/lib/sorcery/controller.rb +1 -0
  9. data/lib/sorcery/controller/submodules/external.rb +1 -1
  10. data/lib/sorcery/controller/submodules/external/protocols/oauth2.rb +2 -2
  11. data/lib/sorcery/controller/submodules/external/providers/facebook.rb +7 -2
  12. data/lib/sorcery/controller/submodules/external/providers/github.rb +4 -4
  13. data/lib/sorcery/controller/submodules/external/providers/google.rb +4 -4
  14. data/lib/sorcery/controller/submodules/external/providers/liveid.rb +1 -1
  15. data/lib/sorcery/model/adapters/mongo_mapper.rb +1 -1
  16. data/lib/sorcery/model/adapters/mongoid.rb +2 -2
  17. data/lib/sorcery/model/submodules/brute_force_protection.rb +2 -2
  18. data/lib/sorcery/model/submodules/reset_password.rb +10 -3
  19. data/lib/sorcery/model/submodules/user_activation.rb +14 -6
  20. data/sorcery.gemspec +15 -8
  21. data/spec/Gemfile.lock +15 -18
  22. data/spec/rails3/Gemfile +1 -0
  23. data/spec/rails3/Gemfile.lock +21 -23
  24. data/spec/rails3/spec/controller_oauth2_spec.rb +6 -4
  25. data/spec/rails3_mongo_mapper/Gemfile +1 -0
  26. data/spec/rails3_mongo_mapper/Gemfile.lock +31 -37
  27. data/spec/rails3_mongoid/Gemfile +1 -0
  28. data/spec/rails3_mongoid/Gemfile.lock +23 -24
  29. data/spec/shared_examples/user_activation_shared_examples.rb +71 -41
  30. data/spec/shared_examples/user_reset_password_shared_examples.rb +76 -31
  31. metadata +63 -40
@@ -5,7 +5,8 @@ def stub_all_oauth2_requests!
5
5
  auth_code = OAuth2::Strategy::AuthCode.any_instance
6
6
  access_token = mock(OAuth2::AccessToken)
7
7
  access_token.stub(:token_param=)
8
- access_token.stub(:get).and_return({
8
+ response = mock(OAuth2::Response)
9
+ response.stub(:body).and_return({
9
10
  "id"=>"123",
10
11
  "name"=>"Noam Ben Ari",
11
12
  "first_name"=>"Noam",
@@ -21,7 +22,8 @@ def stub_all_oauth2_requests!
21
22
  "languages"=>[{"id"=>"108405449189952", "name"=>"Hebrew"}, {"id"=>"106059522759137", "name"=>"English"}, {"id"=>"112624162082677", "name"=>"Russian"}],
22
23
  "verified"=>true,
23
24
  "updated_time"=>"2011-02-16T20:59:38+0000"}.to_json)
24
- auth_code.stub(:get_access_token).and_return(access_token)
25
+ access_token.stub(:get).and_return(response)
26
+ auth_code.stub(:get_token).and_return(access_token)
25
27
  end
26
28
 
27
29
  describe ApplicationController do
@@ -84,7 +86,7 @@ describe ApplicationController do
84
86
  create_new_user
85
87
  get :login_at_test3
86
88
  response.should be_a_redirect
87
- response.should redirect_to("https://github.com/oauth/authorize?response_type=code&client_id=#{::Sorcery::Controller::Config.github.key}&redirect_uri=http%3A%2F%2Fblabla.com&scope=&display=")
89
+ response.should redirect_to("https://github.com/login/oauth/authorize?response_type=code&client_id=#{::Sorcery::Controller::Config.github.key}&redirect_uri=http%3A%2F%2Fblabla.com&scope=&display=")
88
90
  end
89
91
 
90
92
  it "'login_from' logins if user exists (github)" do
@@ -239,4 +241,4 @@ describe ApplicationController do
239
241
  ActionMailer::Base.deliveries.size.should == old_size
240
242
  end
241
243
  end
242
- end
244
+ end
@@ -1,5 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
+ gem 'bcrypt-ruby', '~> 3.0.0'
3
4
  gem 'rails', '3.0.3'
4
5
  gem "sorcery", '>= 0.1.0', :path => '../../'
5
6
  gem "mongo_mapper"
@@ -1,11 +1,8 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- sorcery (0.7.5)
5
- bcrypt-ruby (~> 3.0.0)
4
+ sorcery (0.7.6)
6
5
  oauth (~> 0.4.4)
7
- oauth (~> 0.4.4)
8
- oauth2 (~> 0.5.1)
9
6
  oauth2 (~> 0.5.1)
10
7
 
11
8
  GEM
@@ -38,22 +35,23 @@ GEM
38
35
  activemodel (= 3.0.3)
39
36
  activesupport (= 3.0.3)
40
37
  activesupport (3.0.3)
41
- addressable (2.2.6)
38
+ addressable (2.2.7)
42
39
  archive-tar-minitar (0.5.2)
43
40
  arel (2.0.10)
44
41
  bcrypt-ruby (3.0.1)
45
- bson (1.4.0)
46
- bson_ext (1.4.0)
42
+ bson (1.6.0)
43
+ bson_ext (1.6.0)
44
+ bson (= 1.6.0)
47
45
  builder (2.1.2)
48
- coderay (0.9.8)
49
- columnize (0.3.5)
46
+ coderay (1.0.5)
47
+ columnize (0.3.6)
50
48
  diff-lcs (1.1.3)
51
49
  erubis (2.6.6)
52
50
  abstract (>= 1.0.0)
53
- faraday (0.7.5)
54
- addressable (~> 2.2.6)
55
- multipart-post (~> 1.1.3)
56
- rack (>= 1.1.0, < 2)
51
+ faraday (0.7.6)
52
+ addressable (~> 2.2)
53
+ multipart-post (~> 1.1)
54
+ rack (~> 1.1)
57
55
  i18n (0.6.0)
58
56
  linecache19 (0.5.12)
59
57
  ruby_core_source (>= 0.1.4)
@@ -62,30 +60,28 @@ GEM
62
60
  i18n (>= 0.4.0)
63
61
  mime-types (~> 1.16)
64
62
  treetop (~> 1.4.8)
65
- method_source (0.6.7)
66
- ruby_parser (>= 2.3.1)
63
+ method_source (0.7.1)
67
64
  mime-types (1.17.2)
68
- mongo (1.4.0)
69
- bson (= 1.4.0)
70
- mongo_mapper (0.10.1)
65
+ mongo (1.6.0)
66
+ bson (= 1.6.0)
67
+ mongo_mapper (0.11.0)
71
68
  activemodel (~> 3.0)
72
69
  activesupport (~> 3.0)
73
70
  plucky (~> 0.4.0)
74
- multi_json (1.0.3)
75
- multipart-post (1.1.4)
71
+ multi_json (1.1.0)
72
+ multipart-post (1.1.5)
76
73
  oauth (0.4.5)
77
- oauth2 (0.5.1)
78
- faraday (~> 0.7.4)
79
- multi_json (~> 1.0.3)
80
- plucky (0.4.3)
81
- mongo (~> 1.3)
74
+ oauth2 (0.5.2)
75
+ faraday (~> 0.7)
76
+ multi_json (~> 1.0)
77
+ plucky (0.4.4)
78
+ mongo (~> 1.5)
82
79
  polyglot (0.3.3)
83
- pry (0.9.7.4)
84
- coderay (~> 0.9.8)
85
- method_source (~> 0.6.7)
86
- ruby_parser (>= 2.3.1)
87
- slop (~> 2.1.0)
88
- rack (1.2.4)
80
+ pry (0.9.8.3)
81
+ coderay (~> 1.0.5)
82
+ method_source (~> 0.7.1)
83
+ slop (>= 2.4.4, < 3)
84
+ rack (1.2.5)
89
85
  rack-mount (0.6.14)
90
86
  rack (>= 1.0.0)
91
87
  rack-test (0.5.7)
@@ -127,14 +123,11 @@ GEM
127
123
  ruby-debug-base19 (>= 0.11.19)
128
124
  ruby_core_source (0.1.5)
129
125
  archive-tar-minitar (>= 0.5.2)
130
- ruby_parser (2.3.1)
131
- sexp_processor (~> 3.0)
132
- sexp_processor (3.0.8)
133
- simplecov (0.5.4)
134
- multi_json (~> 1.0.3)
126
+ simplecov (0.6.1)
127
+ multi_json (~> 1.0)
135
128
  simplecov-html (~> 0.5.3)
136
129
  simplecov-html (0.5.3)
137
- slop (2.1.0)
130
+ slop (2.4.4)
138
131
  thor (0.14.6)
139
132
  timecop (0.3.5)
140
133
  treetop (1.4.10)
@@ -146,6 +139,7 @@ PLATFORMS
146
139
  ruby
147
140
 
148
141
  DEPENDENCIES
142
+ bcrypt-ruby (~> 3.0.0)
149
143
  bson_ext (~> 1.3)
150
144
  mongo_mapper
151
145
  pry
@@ -1,5 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
+ gem 'bcrypt-ruby', '~> 3.0.0'
3
4
  gem 'rails', '3.0.3'
4
5
  gem "sorcery", '>= 0.1.0', :path => '../../'
5
6
  gem "mongoid", "~> 2.0"
@@ -1,11 +1,8 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- sorcery (0.7.5)
5
- bcrypt-ruby (~> 3.0.0)
4
+ sorcery (0.7.6)
6
5
  oauth (~> 0.4.4)
7
- oauth (~> 0.4.4)
8
- oauth2 (~> 0.5.1)
9
6
  oauth2 (~> 0.5.1)
10
7
 
11
8
  GEM
@@ -38,21 +35,22 @@ GEM
38
35
  activemodel (= 3.0.3)
39
36
  activesupport (= 3.0.3)
40
37
  activesupport (3.0.3)
41
- addressable (2.2.6)
38
+ addressable (2.2.7)
42
39
  archive-tar-minitar (0.5.2)
43
40
  arel (2.0.10)
44
41
  bcrypt-ruby (3.0.1)
45
- bson (1.4.0)
46
- bson_ext (1.4.0)
42
+ bson (1.6.0)
43
+ bson_ext (1.6.0)
44
+ bson (= 1.6.0)
47
45
  builder (2.1.2)
48
- columnize (0.3.5)
46
+ columnize (0.3.6)
49
47
  diff-lcs (1.1.3)
50
48
  erubis (2.6.6)
51
49
  abstract (>= 1.0.0)
52
- faraday (0.7.5)
53
- addressable (~> 2.2.6)
54
- multipart-post (~> 1.1.3)
55
- rack (>= 1.1.0, < 2)
50
+ faraday (0.7.6)
51
+ addressable (~> 2.2)
52
+ multipart-post (~> 1.1)
53
+ rack (~> 1.1)
56
54
  i18n (0.6.0)
57
55
  linecache19 (0.5.12)
58
56
  ruby_core_source (>= 0.1.4)
@@ -62,20 +60,20 @@ GEM
62
60
  mime-types (~> 1.16)
63
61
  treetop (~> 1.4.8)
64
62
  mime-types (1.17.2)
65
- mongo (1.4.0)
66
- bson (= 1.4.0)
67
- mongoid (2.2.4)
68
- activemodel (~> 3.0)
63
+ mongo (1.6.0)
64
+ bson (= 1.6.0)
65
+ mongoid (2.2.6)
66
+ activemodel (~> 3.0.0)
69
67
  mongo (~> 1.3)
70
68
  tzinfo (~> 0.3.22)
71
- multi_json (1.0.3)
72
- multipart-post (1.1.4)
69
+ multi_json (1.1.0)
70
+ multipart-post (1.1.5)
73
71
  oauth (0.4.5)
74
- oauth2 (0.5.1)
75
- faraday (~> 0.7.4)
76
- multi_json (~> 1.0.3)
72
+ oauth2 (0.5.2)
73
+ faraday (~> 0.7)
74
+ multi_json (~> 1.0)
77
75
  polyglot (0.3.3)
78
- rack (1.2.4)
76
+ rack (1.2.5)
79
77
  rack-mount (0.6.14)
80
78
  rack (>= 1.0.0)
81
79
  rack-test (0.5.7)
@@ -117,8 +115,8 @@ GEM
117
115
  ruby-debug-base19 (>= 0.11.19)
118
116
  ruby_core_source (0.1.5)
119
117
  archive-tar-minitar (>= 0.5.2)
120
- simplecov (0.5.4)
121
- multi_json (~> 1.0.3)
118
+ simplecov (0.6.1)
119
+ multi_json (~> 1.0)
122
120
  simplecov-html (~> 0.5.3)
123
121
  simplecov-html (0.5.3)
124
122
  thor (0.14.6)
@@ -132,6 +130,7 @@ PLATFORMS
132
130
  ruby
133
131
 
134
132
  DEPENDENCIES
133
+ bcrypt-ruby (~> 3.0.0)
135
134
  bson_ext (~> 1.3)
136
135
  mongoid (~> 2.0)
137
136
  rails (= 3.0.3)
@@ -34,9 +34,18 @@ shared_examples_for "rails_3_activation_model" do
34
34
  sorcery_model_property_set(:activation_success_email_method_name, :my_activation_email)
35
35
  User.sorcery_config.activation_success_email_method_name.should equal(:my_activation_email)
36
36
  end
37
+
38
+ it "should enable configuration option 'activation_mailer_disabled'" do
39
+ sorcery_model_property_set(:activation_mailer_disabled, :my_activation_mailer_disabled)
40
+ User.sorcery_config.activation_mailer_disabled.should equal(:my_activation_mailer_disabled)
41
+ end
37
42
 
38
- it "if mailer is nil on activation, throw exception!" do
39
- expect{sorcery_reload!([:user_activation])}.to raise_error(ArgumentError)
43
+ it "if mailer is nil and mailer is enabled, throw exception!" do
44
+ expect{sorcery_reload!([:user_activation], :activation_mailer_disabled => false)}.to raise_error(ArgumentError)
45
+ end
46
+
47
+ it "if mailer is disabled and mailer is nil, do NOT throw exception" do
48
+ expect{sorcery_reload!([:user_activation], :activation_mailer_disabled => true)}.to_not raise_error
40
49
  end
41
50
  end
42
51
 
@@ -64,46 +73,67 @@ shared_examples_for "rails_3_activation_model" do
64
73
  @user2.activation_state.should == "active"
65
74
  User.find_by_activation_token(activation_token).should be_nil
66
75
  end
67
-
68
- it "should send the user an activation email" do
69
- old_size = ActionMailer::Base.deliveries.size
70
- create_new_user
71
- ActionMailer::Base.deliveries.size.should == old_size + 1
72
- end
73
-
74
- it "subsequent saves do not send activation email" do
75
- old_size = ActionMailer::Base.deliveries.size
76
- @user.username = "Shauli"
77
- @user.save!
78
- ActionMailer::Base.deliveries.size.should == old_size
79
- end
80
-
81
- it "should send the user an activation success email on successful activation" do
82
- old_size = ActionMailer::Base.deliveries.size
83
- @user.activate!
84
- ActionMailer::Base.deliveries.size.should == old_size + 1
85
- end
86
-
87
- it "subsequent saves do not send activation success email" do
88
- @user.activate!
89
- old_size = ActionMailer::Base.deliveries.size
90
- @user.username = "Shauli"
91
- @user.save!
92
- ActionMailer::Base.deliveries.size.should == old_size
93
- end
94
-
95
- it "activation needed email is optional" do
96
- sorcery_model_property_set(:activation_needed_email_method_name, nil)
97
- old_size = ActionMailer::Base.deliveries.size
98
- create_new_user
99
- ActionMailer::Base.deliveries.size.should == old_size
76
+
77
+
78
+ context "mailer is enabled" do
79
+ it "should send the user an activation email" do
80
+ old_size = ActionMailer::Base.deliveries.size
81
+ create_new_user
82
+ ActionMailer::Base.deliveries.size.should == old_size + 1
83
+ end
84
+
85
+ it "subsequent saves do not send activation email" do
86
+ old_size = ActionMailer::Base.deliveries.size
87
+ @user.username = "Shauli"
88
+ @user.save!
89
+ ActionMailer::Base.deliveries.size.should == old_size
90
+ end
91
+
92
+ it "should send the user an activation success email on successful activation" do
93
+ old_size = ActionMailer::Base.deliveries.size
94
+ @user.activate!
95
+ ActionMailer::Base.deliveries.size.should == old_size + 1
96
+ end
97
+
98
+ it "subsequent saves do not send activation success email" do
99
+ @user.activate!
100
+ old_size = ActionMailer::Base.deliveries.size
101
+ @user.username = "Shauli"
102
+ @user.save!
103
+ ActionMailer::Base.deliveries.size.should == old_size
104
+ end
105
+
106
+ it "activation needed email is optional" do
107
+ sorcery_model_property_set(:activation_needed_email_method_name, nil)
108
+ old_size = ActionMailer::Base.deliveries.size
109
+ create_new_user
110
+ ActionMailer::Base.deliveries.size.should == old_size
111
+ end
112
+
113
+ it "activation success email is optional" do
114
+ sorcery_model_property_set(:activation_success_email_method_name, nil)
115
+ old_size = ActionMailer::Base.deliveries.size
116
+ @user.activate!
117
+ ActionMailer::Base.deliveries.size.should == old_size
118
+ end
100
119
  end
101
-
102
- it "activation success email is optional" do
103
- sorcery_model_property_set(:activation_success_email_method_name, nil)
104
- old_size = ActionMailer::Base.deliveries.size
105
- @user.activate!
106
- ActionMailer::Base.deliveries.size.should == old_size
120
+
121
+ context "mailer has been disabled" do
122
+ before(:each) do
123
+ sorcery_reload!([:user_activation], :activation_mailer_disabled => true, :user_activation_mailer => ::SorceryMailer)
124
+ end
125
+
126
+ it "should not send the user an activation email" do
127
+ old_size = ActionMailer::Base.deliveries.size
128
+ create_new_user
129
+ ActionMailer::Base.deliveries.size.should == old_size
130
+ end
131
+
132
+ it "should not send the user an activation success email on successful activation" do
133
+ old_size = ActionMailer::Base.deliveries.size
134
+ @user.activate!
135
+ ActionMailer::Base.deliveries.size.should == old_size
136
+ end
107
137
  end
108
138
  end
109
139
 
@@ -33,7 +33,20 @@ shared_examples_for "rails_3_reset_password_model" do
33
33
  sorcery_model_property_set(:reset_password_mailer, TestUser)
34
34
  User.sorcery_config.reset_password_mailer.should equal(TestUser)
35
35
  end
36
+
37
+ it "should enable configuration option 'reset_password_mailer_disabled'" do
38
+ sorcery_model_property_set(:reset_password_mailer_disabled, :my_reset_password_mailer_disabled)
39
+ User.sorcery_config.reset_password_mailer_disabled.should equal(:my_reset_password_mailer_disabled)
40
+ end
36
41
 
42
+ it "if mailer is nil and mailer is enabled, throw exception!" do
43
+ expect{sorcery_reload!([:reset_password], :reset_password_mailer_disabled => false)}.to raise_error(ArgumentError)
44
+ end
45
+
46
+ it "if mailer is disabled and mailer is nil, do NOT throw exception" do
47
+ expect{sorcery_reload!([:reset_password], :reset_password_mailer_disabled => true)}.to_not raise_error
48
+ end
49
+
37
50
  it "should allow configuration option 'reset_password_email_method_name'" do
38
51
  sorcery_model_property_set(:reset_password_email_method_name, :my_mailer_method)
39
52
  User.sorcery_config.reset_password_email_method_name.should equal(:my_mailer_method)
@@ -125,11 +138,69 @@ shared_examples_for "rails_3_reset_password_model" do
125
138
  @user.reset_password_token.should_not == old_password_code
126
139
  end
127
140
 
128
- it "should send an email on reset" do
129
- create_new_user
130
- old_size = ActionMailer::Base.deliveries.size
131
- @user.deliver_reset_password_instructions!
132
- ActionMailer::Base.deliveries.size.should == old_size + 1
141
+ context "mailer is enabled" do
142
+ it "should send an email on reset" do
143
+ create_new_user
144
+ old_size = ActionMailer::Base.deliveries.size
145
+ @user.deliver_reset_password_instructions!
146
+ ActionMailer::Base.deliveries.size.should == old_size + 1
147
+ end
148
+
149
+ it "should not send an email if time between emails has not passed since last email" do
150
+ create_new_user
151
+ sorcery_model_property_set(:reset_password_time_between_emails, 10000)
152
+ old_size = ActionMailer::Base.deliveries.size
153
+ @user.deliver_reset_password_instructions!
154
+ ActionMailer::Base.deliveries.size.should == old_size + 1
155
+ @user.deliver_reset_password_instructions!
156
+ ActionMailer::Base.deliveries.size.should == old_size + 1
157
+ end
158
+
159
+ it "should send an email if time between emails has passed since last email" do
160
+ create_new_user
161
+ sorcery_model_property_set(:reset_password_time_between_emails, 0.5)
162
+ old_size = ActionMailer::Base.deliveries.size
163
+ @user.deliver_reset_password_instructions!
164
+ ActionMailer::Base.deliveries.size.should == old_size + 1
165
+ Timecop.travel(Time.now.in_time_zone+0.5)
166
+ @user.deliver_reset_password_instructions!
167
+ ActionMailer::Base.deliveries.size.should == old_size + 2
168
+ end
169
+ end
170
+
171
+ context "mailer is disabled" do
172
+
173
+ before(:all) do
174
+ sorcery_reload!([:reset_password], :reset_password_mailer_disabled => true, :reset_password_mailer => ::SorceryMailer)
175
+ end
176
+
177
+ it "should send an email on reset" do
178
+ create_new_user
179
+ old_size = ActionMailer::Base.deliveries.size
180
+ @user.deliver_reset_password_instructions!
181
+ ActionMailer::Base.deliveries.size.should == old_size
182
+ end
183
+
184
+ it "should not send an email if time between emails has not passed since last email" do
185
+ create_new_user
186
+ sorcery_model_property_set(:reset_password_time_between_emails, 10000)
187
+ old_size = ActionMailer::Base.deliveries.size
188
+ @user.deliver_reset_password_instructions!
189
+ ActionMailer::Base.deliveries.size.should == old_size
190
+ @user.deliver_reset_password_instructions!
191
+ ActionMailer::Base.deliveries.size.should == old_size
192
+ end
193
+
194
+ it "should send an email if time between emails has passed since last email" do
195
+ create_new_user
196
+ sorcery_model_property_set(:reset_password_time_between_emails, 0.5)
197
+ old_size = ActionMailer::Base.deliveries.size
198
+ @user.deliver_reset_password_instructions!
199
+ ActionMailer::Base.deliveries.size.should == old_size
200
+ Timecop.travel(Time.now.in_time_zone+0.5)
201
+ @user.deliver_reset_password_instructions!
202
+ ActionMailer::Base.deliveries.size.should == old_size
203
+ end
133
204
  end
134
205
 
135
206
  it "when change_password! is called, should delete reset_password_token" do
@@ -140,35 +211,13 @@ shared_examples_for "rails_3_reset_password_model" do
140
211
  @user.save!
141
212
  @user.reset_password_token.should be_nil
142
213
  end
143
-
144
- it "should not send an email if time between emails has not passed since last email" do
145
- create_new_user
146
- sorcery_model_property_set(:reset_password_time_between_emails, 10000)
147
- old_size = ActionMailer::Base.deliveries.size
148
- @user.deliver_reset_password_instructions!
149
- ActionMailer::Base.deliveries.size.should == old_size + 1
150
- @user.deliver_reset_password_instructions!
151
- ActionMailer::Base.deliveries.size.should == old_size + 1
152
- end
153
214
 
154
215
  it "should return false if time between emails has not passed since last email" do
155
216
  create_new_user
156
217
  sorcery_model_property_set(:reset_password_time_between_emails, 10000)
157
- old_size = ActionMailer::Base.deliveries.size
158
218
  @user.deliver_reset_password_instructions!
159
219
  @user.deliver_reset_password_instructions!.should == false
160
220
  end
161
-
162
- it "should send an email if time between emails has passed since last email" do
163
- create_new_user
164
- sorcery_model_property_set(:reset_password_time_between_emails, 0.5)
165
- old_size = ActionMailer::Base.deliveries.size
166
- @user.deliver_reset_password_instructions!
167
- ActionMailer::Base.deliveries.size.should == old_size + 1
168
- Timecop.travel(Time.now.in_time_zone+0.5)
169
- @user.deliver_reset_password_instructions!
170
- ActionMailer::Base.deliveries.size.should == old_size + 2
171
- end
172
221
 
173
222
  it "should encrypt properly on reset" do
174
223
  create_new_user
@@ -177,9 +226,5 @@ shared_examples_for "rails_3_reset_password_model" do
177
226
  Sorcery::CryptoProviders::BCrypt.matches?(@user.crypted_password,"blagu",@user.salt).should be_true
178
227
  end
179
228
 
180
- it "if mailer is nil on activation, throw exception!" do
181
- expect{sorcery_reload!([:reset_password])}.to raise_error(ArgumentError)
182
- end
183
-
184
229
  end
185
230
  end