authkit 0.4.0 → 0.5.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -3
  3. data/Rakefile +3 -2
  4. data/lib/authkit/version.rb +1 -1
  5. data/lib/generators/authkit/install_generator.rb +181 -35
  6. data/lib/generators/authkit/templates/app/controllers/application_controller.rb +6 -0
  7. data/lib/generators/authkit/templates/app/controllers/auths_controller.rb +144 -0
  8. data/lib/generators/authkit/templates/app/controllers/email_confirmation_controller.rb +1 -1
  9. data/lib/generators/authkit/templates/app/controllers/password_reset_controller.rb +7 -1
  10. data/lib/generators/authkit/templates/app/controllers/sessions_controller.rb +11 -2
  11. data/lib/generators/authkit/templates/app/controllers/signup_controller.rb +4 -2
  12. data/lib/generators/authkit/templates/app/controllers/upload_controller.rb +78 -0
  13. data/lib/generators/authkit/templates/app/controllers/users_controller.rb +2 -2
  14. data/lib/generators/authkit/templates/app/forms/signup.rb +57 -7
  15. data/lib/generators/authkit/templates/app/helpers/auths_helper.rb +26 -0
  16. data/lib/generators/authkit/templates/app/helpers/upload_helper.rb +118 -0
  17. data/lib/generators/authkit/templates/app/models/auth.rb +81 -0
  18. data/lib/generators/authkit/templates/app/models/avatar.rb +45 -0
  19. data/lib/generators/authkit/templates/app/models/user.rb +53 -26
  20. data/lib/generators/authkit/templates/app/views/auths/connect.html.erb +34 -0
  21. data/lib/generators/authkit/templates/app/views/password_change/show.html.erb +9 -9
  22. data/lib/generators/authkit/templates/app/views/password_reset/show.html.erb +6 -6
  23. data/lib/generators/authkit/templates/app/views/sessions/new.html.erb +25 -7
  24. data/lib/generators/authkit/templates/app/views/signup/new.html.erb +44 -32
  25. data/lib/generators/authkit/templates/app/views/users/complete.html.erb +39 -0
  26. data/lib/generators/authkit/templates/app/views/users/edit.html.erb +31 -31
  27. data/lib/generators/authkit/templates/app/workers/avatar_import_worker.rb +12 -0
  28. data/lib/generators/authkit/templates/config/initializers/filter_parameter_logging.rb +2 -2
  29. data/lib/generators/authkit/templates/config/initializers/omniauth.rb +59 -0
  30. data/lib/generators/authkit/templates/config/initializers/paperclip.rb +68 -0
  31. data/lib/generators/authkit/templates/db/migrate/add_authkit_fields_to_users.rb +8 -6
  32. data/lib/generators/authkit/templates/db/migrate/create_auths.rb +24 -0
  33. data/lib/generators/authkit/templates/db/migrate/create_avatars.rb +27 -0
  34. data/lib/generators/authkit/templates/lib/full_name_splitter.rb +111 -0
  35. data/lib/generators/authkit/templates/lib/username_format_validator.rb +11 -0
  36. data/lib/generators/authkit/templates/spec/controllers/application_controller_spec.rb +31 -38
  37. data/lib/generators/authkit/templates/spec/controllers/auths_controller_spec.rb +72 -0
  38. data/lib/generators/authkit/templates/spec/controllers/email_confirmation_controller_spec.rb +25 -27
  39. data/lib/generators/authkit/templates/spec/controllers/password_change_controller_spec.rb +30 -30
  40. data/lib/generators/authkit/templates/spec/controllers/password_reset_controller_spec.rb +20 -20
  41. data/lib/generators/authkit/templates/spec/controllers/sessions_controller_spec.rb +33 -33
  42. data/lib/generators/authkit/templates/spec/controllers/signup_controller_spec.rb +19 -19
  43. data/lib/generators/authkit/templates/spec/controllers/users_controller_spec.rb +21 -21
  44. data/lib/generators/authkit/templates/spec/factories/user.rb +3 -3
  45. data/lib/generators/authkit/templates/spec/forms/signup_spec.rb +32 -31
  46. data/lib/generators/authkit/templates/spec/models/auth_spec.rb +18 -0
  47. data/lib/generators/authkit/templates/spec/models/user_spec.rb +72 -78
  48. data/spec/rails_helper.rb +50 -0
  49. data/spec/spec_helper.rb +70 -13
  50. metadata +35 -17
  51. data/lib/generators/authkit/templates/spec/spec_helper.rb +0 -4
@@ -0,0 +1,18 @@
1
+ require 'rails_helper'
2
+
3
+ describe Auth do
4
+ let(:auth_params) { attributes_for(:auth) }
5
+
6
+ it "finds the full name"
7
+ it "returns the provider name if there is no full name"
8
+ it "finds the first name"
9
+ it "finds the last name"
10
+ it "finds the image url"
11
+ it "finds the image for a tumblr url"
12
+ it "finds the username"
13
+ it "does not find a username for google"
14
+ it "has provider specific tests"
15
+ it "knows how to refresh google tokens"
16
+ it "returns a formatted provider name"
17
+ it "parses the env"
18
+ end
@@ -1,32 +1,25 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
 
3
3
  describe User do
4
4
  let(:user_params) { attributes_for(:user) }
5
5
 
6
6
  it "has secure password support" do
7
- User.new.should respond_to(:authenticate)
7
+ expect(User.new).to respond_to(:authenticate)
8
8
  end
9
9
 
10
10
  it "has one time password support" do
11
- User.new.should respond_to(:otp_secret_key)
11
+ expect(User.new).to respond_to(:otp_secret_key)
12
12
  end
13
13
 
14
14
  it "accepts a password confirmation" do
15
- User.new.should respond_to(:password_confirmation=)
15
+ expect(User.new).to respond_to(:password_confirmation=)
16
16
  end
17
17
 
18
18
  it "downcases the email address" do
19
19
  user = User.new
20
20
  user.email = "SIR@CAPSALOCK.COM"
21
21
  user.valid?
22
- user.email.should == "sir@capsalock.com"
23
- end
24
-
25
- it "knows if the password was set" do
26
- user = User.new
27
- user.send(:password_set?).should == false
28
- user.password = "example"
29
- user.send(:password_set?).should == true
22
+ expect(user.email).to eq("sir@capsalock.com")
30
23
  end
31
24
 
32
25
  describe "validations" do
@@ -34,19 +27,20 @@ describe User do
34
27
  before(:each) do
35
28
  create(:user)
36
29
  end
37
- it { should validate_uniqueness_of(:username) }
38
- it { should validate_uniqueness_of(:email) }
30
+ <% if username? %>it { should validate_uniqueness_of(:username) }
31
+ <% end %>it { should validate_uniqueness_of(:email) }
39
32
  it "validates the uniqueness of the the confirmation email" do
40
- user = User.new(user_params.merge(email: "old@example.com", username: "old"))
33
+ existing_user = create(:user)
34
+ user = build(:user, email: "old@example.com")
41
35
  user.confirmation_email = "new@example.com"
42
- user.should be_valid
43
- user.confirmation_email = "test@example.com"
44
- user.should_not be_valid
36
+ expect(user).to be_valid
37
+ user.confirmation_email = existing_user.email
38
+ expect(user).to_not be_valid
45
39
  end
46
40
  end
47
41
  it { should validate_presence_of(:confirmation_email) }
48
- it { should validate_presence_of(:username) }
49
- it { should validate_presence_of(:password) }
42
+ <% if username? %>it { should validate_presence_of(:username) }
43
+ <% end %>it { should validate_presence_of(:password) }
50
44
  it { should validate_confirmation_of(:password) }
51
45
 
52
46
  end
@@ -54,65 +48,65 @@ describe User do
54
48
  describe "tokens" do
55
49
  it "sets the remember token" do
56
50
  user = User.new
57
- user.should_receive(:save!).and_return(true)
51
+ expect(user).to receive(:save!).and_return(true)
58
52
  user.set_remember_token
59
- user.remember_token.should_not be_blank
60
- user.remember_token_created_at.should_not be_blank
53
+ expect(user.remember_token).to_not be_blank
54
+ expect(user.remember_token_created_at).to_not be_blank
61
55
  end
62
56
 
63
57
  it "clears the remember token" do
64
58
  user = User.new
65
- user.should_receive(:save!).and_return(true)
59
+ expect(user).to receive(:save!).and_return(true)
66
60
  user.remember_token = "TOKEN"
67
61
  user.remember_token_created_at = Time.now
68
62
  user.clear_remember_token
69
- user.remember_token.should be_nil
70
- user.remember_token_created_at.should be_nil
63
+ expect(user.remember_token).to be_nil
64
+ expect(user.remember_token_created_at).to be_nil
71
65
  end
72
66
  end
73
67
 
74
68
  describe "token expiry" do
75
69
  it "should expire reset password tokens" do
76
70
  user = User.new
77
- user.reset_password_token_expired?.should == true
71
+ expect(user.reset_password_token_expired?).to eq(true)
78
72
  user.reset_password_token_created_at = 10.minutes.ago
79
- user.reset_password_token_expired?.should == false
73
+ expect(user.reset_password_token_expired?).to eq(false)
80
74
  user.reset_password_token_created_at = 1.day.ago
81
- user.reset_password_token_expired?.should == true
75
+ expect(user.reset_password_token_expired?).to eq(true)
82
76
  end
83
77
 
84
78
  it "should expire confirmation tokens" do
85
79
  user = User.new
86
- user.confirmation_token_expired?.should == true
80
+ expect(user.confirmation_token_expired?).to eq(true)
87
81
  user.confirmation_token_created_at = 2.days.ago
88
- user.confirmation_token_expired?.should == false
82
+ expect(user.confirmation_token_expired?).to eq(false)
89
83
  user.confirmation_token_created_at = 3.days.ago
90
- user.confirmation_token_expired?.should == true
84
+ expect(user.confirmation_token_expired?).to eq(true)
91
85
  end
92
86
 
93
87
  it "should expire remember tokens" do
94
88
  user = User.new
95
- user.remember_token_expired?.should == true
89
+ expect(user.remember_token_expired?).to eq(true)
96
90
  user.remember_token_created_at = 30.days.ago
97
- user.remember_token_expired?.should == false
91
+ expect(user.remember_token_expired?).to eq(false)
98
92
  user.remember_token_created_at = 1.years.ago
99
- user.remember_token_expired?.should == true
93
+ expect(user.remember_token_expired?).to eq(true)
100
94
  end
101
95
  end
102
96
 
103
97
  describe "display name" do
104
98
  it "has a display name" do
105
99
  user = User.new(first_name: "Boss", last_name: "Hogg")
106
- user.display_name.should == "Boss Hogg"
100
+ expect(user.full_name).to eq("Boss Hogg")
107
101
  user.first_name = nil
108
- user.display_name.should == "Hogg"
102
+ expect(user.full_name).to eq("Hogg")
109
103
  end
110
104
  end
111
105
 
112
106
  describe "tracking" do
113
107
  let(:user) do
114
108
  user = User.new
115
- user.should_receive(:save).and_return(true)
109
+ expect(user).to receive(:save).and_return(true)
116
110
  user
117
111
  end
118
112
 
@@ -123,28 +117,28 @@ describe User do
123
117
  end
124
118
 
125
119
  it "tracks current sign in" do
126
- Time.stub(:now).and_return(time = Time.now)
120
+ allow(Time).to receive(:now).and_return(time = Time.now)
127
121
  user.track_sign_in(nil)
128
- user.current_sign_in_at.should == time
122
+ expect(user.current_sign_in_at).to eq(time)
129
123
  end
130
124
 
131
125
  it "tracks last sign in" do
132
126
  time = Time.now
133
127
  user.current_sign_in_at = time
134
128
  user.track_sign_in(nil)
135
- user.last_sign_in_at.should == time
129
+ expect(user.last_sign_in_at).to eq(time)
136
130
  end
137
131
 
138
132
  it "tracks current and last ip" do
139
133
  user.track_sign_in(ip = "123.456.789.001")
140
- user.current_sign_in_ip.should == ip
134
+ expect(user.current_sign_in_ip).to eq(ip)
141
135
  end
142
136
 
143
137
  it "tracks current and last ip" do
144
138
  ip = "123.456.789.001"
145
139
  user.current_sign_in_ip = ip
146
140
  user.track_sign_in(nil)
147
- user.last_sign_in_ip.should == ip
141
+ expect(user.last_sign_in_ip).to eq(ip)
148
142
  end
149
143
  end
150
144
 
@@ -154,110 +148,110 @@ describe User do
154
148
  describe "with valid params" do
155
149
  it "confirms the email" do
156
150
  user = User.new
157
- user.should_receive(:save!).and_return(true)
158
- Time.stub(:now).and_return(time = Time.now)
151
+ expect(user).to receive(:save!).and_return(true)
152
+ allow(Time).to receive(:now).and_return(time = Time.now)
159
153
 
160
154
  user.send_confirmation
161
- user.confirmation_token_created_at.should == time
162
- user.confirmation_token.should_not be_blank
155
+ expect(user.confirmation_token_created_at).to eq(time)
156
+ expect(user.confirmation_token).to_not be_blank
163
157
  end
164
158
 
165
159
  it "generates a token before it sends confirmation email instructions" do
166
160
  user = User.new
167
- user.should_receive(:save!).and_return(true)
161
+ expect(user).to receive(:save!).and_return(true)
168
162
  user.send_confirmation
169
- user.confirmation_token.should_not be_blank
170
- user.confirmation_token_created_at.should_not be_blank
163
+ expect(user.confirmation_token).to_not be_blank
164
+ expect(user.confirmation_token_created_at).to_not be_blank
171
165
  end
172
166
 
173
167
  it "sends confirmation email instructions" do
174
168
  user = User.new
175
- user.should_receive(:save!).and_return(true)
169
+ expect(user).to receive(:save!).and_return(true)
176
170
  user.send_confirmation
177
171
  end
178
172
 
179
173
  it "handles confirmed emails" do
180
- user.should_receive(:save).and_return(true)
174
+ expect(user).to receive(:save).and_return(true)
181
175
  user.confirmation_email = "new@example.com"
182
176
  user.confirmation_token = "TOKEN"
183
- user.email_confirmed.should == true
184
- user.confirmation_email.should == user.email
185
- user.confirmation_token.should be_nil
186
- user.confirmation_token_created_at.should be_nil
187
- user.email.should == "new@example.com"
177
+ expect(user.email_confirmed).to eq(true)
178
+ expect(user.confirmation_email).to eq(user.email)
179
+ expect(user.confirmation_token).to be_nil
180
+ expect(user.confirmation_token_created_at).to be_nil
181
+ expect(user.email).to eq("new@example.com")
188
182
  end
189
183
  end
190
184
 
191
185
  it "does not confirm if there is no confirmation token" do
192
186
  user.confirmation_email = "new@example.com"
193
187
  user.confirmation_token = nil
194
- user.email_confirmed.should == false
188
+ expect(user.email_confirmed).to eq(false)
195
189
  end
196
190
 
197
191
  it "does not confirm if there is no confirmation email" do
198
192
  user.confirmation_email = ""
199
193
  user.confirmation_token = "TOKEN"
200
- user.email_confirmed.should == false
194
+ expect(user.email_confirmed).to eq(false)
201
195
  end
202
196
 
203
197
  it "does not confirm emails if they are already used" do
204
- create(:user, email: "new@example.com", username: "newuser")
198
+ create(:user, email: "new@example.com")
205
199
  user.confirmation_email = "new@example.com"
206
200
  user.confirmation_token = "TOKEN"
207
- user.email_confirmed.should == false
208
- user.should have(1).errors_on(:email)
201
+ expect(user.email_confirmed).to eq(false)
202
+ expect(user.errors[:email].size).to eq(1)
209
203
  end
210
204
 
211
205
  it "is pending confirmation if there is a confirmation token" do
212
206
  user = build(:user, confirmation_token: "TOKEN")
213
- user.should be_pending_confirmation
207
+ expect(user).to be_pending_confirmation
214
208
  end
215
209
 
216
210
  it "there is no pending confirmation if there is not a confirmation token" do
217
211
  user = build(:user, confirmation_token: nil)
218
- user.should_not be_pending_confirmation
212
+ expect(user).to_not be_pending_confirmation
219
213
  end
220
214
  end
221
215
 
222
216
  describe "passwords" do
223
217
  it "changes the password if it matches" do
224
218
  user = build(:user)
225
- user.should_receive(:save).and_return(true)
219
+ expect(user).to receive(:save).and_return(true)
226
220
  user.change_password("password", "password")
227
- user.password_digest.should_not be_blank
228
- user.remember_token.should be_nil
229
- user.remember_token_created_at.should be_nil
221
+ expect(user.password_digest).to_not be_blank
222
+ expect(user.remember_token).to be_nil
223
+ expect(user.remember_token_created_at).to be_nil
230
224
  end
231
225
 
232
226
  it "doesn't change the password if it doesn't match" do
233
227
  user = User.new
234
228
  user.remember_token = "token"
235
229
  user.change_password("password", "typotypo")
236
- user.should_not be_valid
237
- user.remember_token.should == "token"
230
+ expect(user).to_not be_valid
231
+ expect(user.remember_token).to eq("token")
238
232
  end
239
233
 
240
234
  it "resets the password" do
241
235
  user = User.new
242
- user.should_receive(:save!).and_return(true)
243
- Time.stub(:now).and_return(time = Time.now)
236
+ expect(user).to receive(:save!).and_return(true)
237
+ allow(Time).to receive(:now).and_return(time = Time.now)
244
238
 
245
239
  user.send_reset_password
246
- user.reset_password_token_created_at.should == time
247
- user.reset_password_token.should_not be_blank
240
+ expect(user.reset_password_token_created_at).to eq(time)
241
+ expect(user.reset_password_token).to_not be_blank
248
242
  end
249
243
 
250
244
  it "generates a token before it sends reset password instructions" do
251
245
  user = User.new
252
- user.should_receive(:save!).and_return(true)
246
+ expect(user).to receive(:save!).and_return(true)
253
247
  user.send_reset_password
254
- user.reset_password_token.should_not be_blank
255
- user.reset_password_token_created_at.should_not be_blank
248
+ expect(user.reset_password_token).to_not be_blank
249
+ expect(user.reset_password_token_created_at).to_not be_blank
256
250
  end
257
251
 
258
252
  it "sends reset password instructions" do
259
253
  user = User.new
260
- user.should_receive(:save!).and_return(true)
254
+ expect(user).to receive(:save!).and_return(true)
261
255
  user.send_reset_password
262
256
  end
263
257
  end
@@ -0,0 +1,50 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require 'spec_helper'
4
+ require File.expand_path('../tmp/sample/config/environment', __FILE__)
5
+ require 'rspec/rails'
6
+ require 'factory_girl'
7
+
8
+ # Requires supporting ruby files with custom matchers and macros, etc, in
9
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
10
+ # run as spec files by default. This means that files in spec/support that end
11
+ # in _spec.rb will both be required and run as specs, causing the specs to be
12
+ # run twice. It is recommended that you do not name files matching this glob to
13
+ # end with _spec.rb. You can configure this pattern with the --pattern
14
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
15
+ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
16
+
17
+ # Checks for pending migrations before tests are run.
18
+ # If you are not using ActiveRecord, you can remove this line.
19
+ ActiveRecord::Migration.maintain_test_schema!
20
+
21
+ RSpec.configure do |config|
22
+
23
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
24
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
25
+
26
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
27
+ # examples within a transaction, remove the following line or assign false
28
+ # instead of true.
29
+ config.use_transactional_fixtures = true
30
+
31
+ # RSpec Rails can automatically mix in different behaviours to your tests
32
+ # based on their file location, for example enabling you to call `get` and
33
+ # `post` in specs under `spec/controllers`.
34
+ #
35
+ # You can disable this behaviour by removing the line below, and instead
36
+ # explicitly tag your specs with their type, e.g.:
37
+ #
38
+ # RSpec.describe UsersController, :type => :controller do
39
+ # # ...
40
+ # end
41
+ #
42
+ # The different available types are documented in the features, such as in
43
+ # https://relishapp.com/rspec/rspec-rails/docs
44
+ config.infer_spec_type_from_file_location!
45
+ config.infer_base_class_for_anonymous_controllers = false
46
+
47
+ # FactoryGirl allows you to quickly create template based objects
48
+ # The syntax methods give you inline `create` and a `build` commands
49
+ config.include FactoryGirl::Syntax::Methods
50
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,18 +1,75 @@
1
- ENV["RAILS_ENV"] ||= 'test'
2
- require File.expand_path('../tmp/sample/config/environment', __FILE__)
3
- require 'rspec/rails'
4
- require 'rspec/autorun'
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, make a
10
+ # separate helper file that requires this one and then use it only in the specs
11
+ # that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+ RSpec.configure do |config|
18
+ # These two settings work together to allow you to limit a spec run
19
+ # to individual examples or groups you care about by tagging them with
20
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
21
+ # get run.
22
+ config.filter_run :focus
23
+ config.run_all_when_everything_filtered = true
5
24
 
6
- Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
25
+ # Many RSpec users commonly either run the entire suite or an individual
26
+ # file, and it's useful to allow more verbose output when running an
27
+ # individual spec file.
28
+ if config.files_to_run.one?
29
+ # Use the documentation formatter for detailed output,
30
+ # unless a formatter has already been configured
31
+ # (e.g. via a command-line flag).
32
+ config.default_formatter = 'doc'
33
+ end
7
34
 
8
- ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
35
+ # Print the 10 slowest examples and example groups at the
36
+ # end of the spec run, to help surface which specs are running
37
+ # particularly slow.
38
+ config.profile_examples = 10
9
39
 
10
- RSpec.configure do |config|
11
- config.use_transactional_fixtures = true
12
- config.infer_base_class_for_anonymous_controllers = false
13
- config.order = "random"
14
- config.include FactoryGirl::Syntax::Methods
40
+ # Run specs in random order to surface order dependencies. If you find an
41
+ # order dependency and want to debug it, you can fix the order by providing
42
+ # the seed, which is printed after each run.
43
+ # --seed 1234
44
+ config.order = :random
45
+
46
+ # Seed global randomization in this process using the `--seed` CLI option.
47
+ # Setting this allows you to use `--seed` to deterministically reproduce
48
+ # test failures related to randomization by passing the same `--seed` value
49
+ # as the one that triggered the failure.
50
+ Kernel.srand config.seed
15
51
 
16
- # Because we are not running things in Rails we need to stub some secrets
17
- config.before(:each) { Rails.application.config.stub(:secret_token).and_return("SECRET") }
52
+ # rspec-expectations config goes here. You can use an alternate
53
+ # assertion/expectation library such as wrong or the stdlib/minitest
54
+ # assertions if you prefer.
55
+ config.expect_with :rspec do |expectations|
56
+ # Enable only the newer, non-monkey-patching expect syntax.
57
+ # For more details, see:
58
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
59
+ expectations.syntax = :expect
60
+ end
61
+
62
+ # rspec-mocks config goes here. You can use an alternate test double
63
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
64
+ config.mock_with :rspec do |mocks|
65
+ # Enable only the newer, non-monkey-patching expect syntax.
66
+ # For more details, see:
67
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
68
+ mocks.syntax = :expect
69
+
70
+ # Prevents you from mocking or stubbing a method that does not exist on
71
+ # a real object. This is generally recommended.
72
+ mocks.verify_partial_doubles = true
73
+ end
18
74
  end
75
+