double_entry 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -1
  3. data/.rubocop.yml +55 -0
  4. data/.travis.yml +23 -12
  5. data/README.md +5 -1
  6. data/Rakefile +8 -3
  7. data/double_entry.gemspec +4 -3
  8. data/lib/active_record/locking_extensions.rb +28 -40
  9. data/lib/active_record/locking_extensions/log_subscriber.rb +4 -4
  10. data/lib/double_entry.rb +0 -2
  11. data/lib/double_entry/account.rb +13 -16
  12. data/lib/double_entry/account_balance.rb +0 -4
  13. data/lib/double_entry/balance_calculator.rb +4 -5
  14. data/lib/double_entry/configurable.rb +0 -2
  15. data/lib/double_entry/configuration.rb +2 -3
  16. data/lib/double_entry/errors.rb +2 -2
  17. data/lib/double_entry/line.rb +13 -16
  18. data/lib/double_entry/locking.rb +13 -18
  19. data/lib/double_entry/reporting.rb +2 -3
  20. data/lib/double_entry/reporting/aggregate.rb +90 -88
  21. data/lib/double_entry/reporting/aggregate_array.rb +58 -58
  22. data/lib/double_entry/reporting/day_range.rb +37 -35
  23. data/lib/double_entry/reporting/hour_range.rb +40 -37
  24. data/lib/double_entry/reporting/line_aggregate.rb +27 -28
  25. data/lib/double_entry/reporting/month_range.rb +67 -67
  26. data/lib/double_entry/reporting/time_range.rb +40 -38
  27. data/lib/double_entry/reporting/time_range_array.rb +3 -5
  28. data/lib/double_entry/reporting/week_range.rb +77 -78
  29. data/lib/double_entry/reporting/year_range.rb +27 -27
  30. data/lib/double_entry/transfer.rb +14 -15
  31. data/lib/double_entry/validation/line_check.rb +92 -86
  32. data/lib/double_entry/version.rb +1 -1
  33. data/lib/generators/double_entry/install/install_generator.rb +1 -2
  34. data/lib/generators/double_entry/install/templates/migration.rb +0 -2
  35. data/script/jack_hammer +1 -1
  36. data/spec/active_record/locking_extensions_spec.rb +45 -38
  37. data/spec/double_entry/account_balance_spec.rb +4 -5
  38. data/spec/double_entry/account_spec.rb +43 -44
  39. data/spec/double_entry/balance_calculator_spec.rb +6 -8
  40. data/spec/double_entry/configuration_spec.rb +14 -16
  41. data/spec/double_entry/line_spec.rb +25 -26
  42. data/spec/double_entry/locking_spec.rb +34 -39
  43. data/spec/double_entry/reporting/aggregate_array_spec.rb +8 -10
  44. data/spec/double_entry/reporting/aggregate_spec.rb +84 -44
  45. data/spec/double_entry/reporting/line_aggregate_spec.rb +7 -6
  46. data/spec/double_entry/reporting/month_range_spec.rb +109 -103
  47. data/spec/double_entry/reporting/time_range_array_spec.rb +145 -135
  48. data/spec/double_entry/reporting/time_range_spec.rb +36 -35
  49. data/spec/double_entry/reporting/week_range_spec.rb +82 -76
  50. data/spec/double_entry/reporting_spec.rb +9 -13
  51. data/spec/double_entry/transfer_spec.rb +13 -15
  52. data/spec/double_entry/validation/line_check_spec.rb +73 -79
  53. data/spec/double_entry_spec.rb +65 -68
  54. data/spec/generators/double_entry/install/install_generator_spec.rb +7 -10
  55. data/spec/spec_helper.rb +68 -10
  56. data/spec/support/accounts.rb +2 -4
  57. data/spec/support/double_entry_spec_helper.rb +4 -4
  58. data/spec/support/gemfiles/Gemfile.rails-3.2.x +1 -0
  59. metadata +31 -2
@@ -1,7 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'spec_helper'
3
- describe DoubleEntry do
4
-
2
+ RSpec.describe DoubleEntry do
5
3
  # these specs blat the DoubleEntry configuration, so take
6
4
  # a copy and clean up after ourselves
7
5
  before do
@@ -18,25 +16,25 @@ describe DoubleEntry do
18
16
 
19
17
  describe 'configuration' do
20
18
  it 'checks for duplicates of accounts' do
21
- expect {
19
+ expect do
22
20
  DoubleEntry.configure do |config|
23
21
  config.define_accounts do |accounts|
24
22
  accounts.define(:identifier => :gah!)
25
23
  accounts.define(:identifier => :gah!)
26
24
  end
27
25
  end
28
- }.to raise_error DoubleEntry::DuplicateAccount
26
+ end.to raise_error DoubleEntry::DuplicateAccount
29
27
  end
30
28
 
31
29
  it 'checks for duplicates of transfers' do
32
- expect {
30
+ expect do
33
31
  DoubleEntry.configure do |config|
34
32
  config.define_transfers do |transfers|
35
33
  transfers.define(:from => :savings, :to => :cash, :code => :xfer)
36
34
  transfers.define(:from => :savings, :to => :cash, :code => :xfer)
37
35
  end
38
36
  end
39
- }.to raise_error DoubleEntry::DuplicateTransfer
37
+ end.to raise_error DoubleEntry::DuplicateTransfer
40
38
  end
41
39
  end
42
40
 
@@ -74,17 +72,17 @@ describe DoubleEntry do
74
72
  end
75
73
  end
76
74
 
77
- context "an unscoped account" do
75
+ context 'an unscoped account' do
78
76
  subject(:unscoped) { DoubleEntry.account(:unscoped) }
79
77
 
80
- it "has an identifier" do
78
+ it 'has an identifier' do
81
79
  expect(unscoped.identifier).to eq :unscoped
82
80
  end
83
81
  end
84
- context "a scoped account" do
82
+ context 'a scoped account' do
85
83
  subject(:scoped) { DoubleEntry.account(:scoped, :scope => scope) }
86
84
 
87
- it "has an identifier" do
85
+ it 'has an identifier' do
88
86
  expect(scoped.identifier).to eq :scoped
89
87
  end
90
88
  end
@@ -122,46 +120,46 @@ describe DoubleEntry do
122
120
  end
123
121
 
124
122
  it 'raises an exception when the transfer is not allowed (wrong direction)' do
125
- expect {
123
+ expect do
126
124
  DoubleEntry.transfer(
127
125
  Money.new(100_00),
128
126
  :from => cash,
129
127
  :to => savings,
130
128
  :code => :xfer,
131
129
  )
132
- }.to raise_error DoubleEntry::TransferNotAllowed
130
+ end.to raise_error DoubleEntry::TransferNotAllowed
133
131
  end
134
132
 
135
133
  it 'raises an exception when the transfer is not allowed (wrong code)' do
136
- expect {
134
+ expect do
137
135
  DoubleEntry.transfer(
138
136
  Money.new(100_00),
139
137
  :from => savings,
140
138
  :to => cash,
141
139
  :code => :yfer,
142
140
  )
143
- }.to raise_error DoubleEntry::TransferNotAllowed
141
+ end.to raise_error DoubleEntry::TransferNotAllowed
144
142
  end
145
143
 
146
144
  it 'raises an exception when the transfer is not allowed (does not exist, at all)' do
147
- expect {
145
+ expect do
148
146
  DoubleEntry.transfer(
149
147
  Money.new(100_00),
150
148
  :from => cash,
151
149
  :to => trash,
152
150
  )
153
- }.to raise_error DoubleEntry::TransferNotAllowed
151
+ end.to raise_error DoubleEntry::TransferNotAllowed
154
152
  end
155
153
 
156
154
  it 'raises an exception when the transfer is not allowed (mismatched currencies)' do
157
- expect {
155
+ expect do
158
156
  DoubleEntry.transfer(
159
157
  Money.new(100_00),
160
158
  :from => trash,
161
159
  :to => bitbucket,
162
- :code => :mismatch_xfer
160
+ :code => :mismatch_xfer,
163
161
  )
164
- }.to raise_error DoubleEntry::MismatchedCurrencies
162
+ end.to raise_error DoubleEntry::MismatchedCurrencies
165
163
  end
166
164
  end
167
165
 
@@ -187,19 +185,19 @@ describe DoubleEntry do
187
185
  let(:debit_line) { lines_for_account(account_b).first }
188
186
 
189
187
  it 'has an amount' do
190
- expect(credit_line.amount).to eq -Money.new(10_00)
191
- expect(debit_line.amount).to eq Money.new(10_00)
188
+ expect(credit_line.amount).to eq(Money.new(-10_00))
189
+ expect(debit_line.amount).to eq(Money.new(10_00))
192
190
  end
193
191
 
194
192
  it 'has a code' do
195
- expect(credit_line.code).to eq :xfer
196
- expect(debit_line.code).to eq :xfer
193
+ expect(credit_line.code).to eq(:xfer)
194
+ expect(debit_line.code).to eq(:xfer)
197
195
  end
198
196
 
199
197
  it 'auto-sets scope when assigning account (and partner_accout, is this implementation?)' do
200
- expect(credit_line[:account]).to eq 'a'
198
+ expect(credit_line[:account]).to eq('a')
201
199
  expect(credit_line[:scope]).to be_nil
202
- expect(credit_line[:partner_account]).to eq 'b'
200
+ expect(credit_line[:partner_account]).to eq('b')
203
201
  expect(credit_line[:partner_scope]).to be_nil
204
202
  end
205
203
 
@@ -215,23 +213,22 @@ describe DoubleEntry do
215
213
  end
216
214
 
217
215
  it 'can reference its partner' do
218
- expect(credit_line.partner).to eq debit_line
219
- expect(debit_line.partner).to eq credit_line
216
+ expect(credit_line.partner).to eq(debit_line)
217
+ expect(debit_line.partner).to eq(credit_line)
220
218
  end
221
219
 
222
220
  it 'can ask for its pair (credit always coming first)' do
223
- expect(credit_line.pair).to eq [credit_line, debit_line]
224
- expect(debit_line.pair).to eq [credit_line, debit_line]
221
+ expect(credit_line.pair).to eq([credit_line, debit_line])
222
+ expect(debit_line.pair).to eq([credit_line, debit_line])
225
223
  end
226
224
 
227
225
  it 'can ask for the account (and get an instance)' do
228
- expect(credit_line.account).to eq account_a
229
- expect(debit_line.account).to eq account_b
226
+ expect(credit_line.account).to eq(account_a)
227
+ expect(debit_line.account).to eq(account_b)
230
228
  end
231
229
  end
232
230
 
233
231
  describe 'balances' do
234
-
235
232
  let(:work) { DoubleEntry.account(:work) }
236
233
  let(:savings) { DoubleEntry.account(:savings) }
237
234
  let(:cash) { DoubleEntry.account(:cash) }
@@ -261,14 +258,14 @@ describe DoubleEntry do
261
258
  end
262
259
  end
263
260
 
264
- Timecop.freeze 3.weeks.ago+1.day do
261
+ Timecop.freeze 3.weeks.ago + 1.day do
265
262
  # got paid from work
266
263
  DoubleEntry.transfer(Money.new(1_000_00), :from => work, :code => :salary, :to => cash)
267
264
  # transfer half salary into savings
268
265
  DoubleEntry.transfer(Money.new(500_00), :from => cash, :code => :xfer, :to => savings)
269
266
  end
270
267
 
271
- Timecop.freeze 2.weeks.ago+1.day do
268
+ Timecop.freeze 2.weeks.ago + 1.day do
272
269
  # got myself a darth vader helmet
273
270
  DoubleEntry.transfer(Money.new(200_00), :from => cash, :code => :purchase, :to => store)
274
271
  # paid off some of my darth vader suit layby (to go with the helmet)
@@ -277,7 +274,7 @@ describe DoubleEntry do
277
274
  DoubleEntry.transfer(Money.new(100_00), :from => cash, :code => :deposit, :to => store)
278
275
  end
279
276
 
280
- Timecop.freeze 1.week.ago+1.day do
277
+ Timecop.freeze 1.week.ago + 1.day do
281
278
  # transfer 200 out of savings
282
279
  DoubleEntry.transfer(Money.new(200_00), :from => savings, :code => :xfer, :to => cash)
283
280
  # pay the remaining balance on the darth vader voice changer module
@@ -291,21 +288,21 @@ describe DoubleEntry do
291
288
  end
292
289
 
293
290
  it 'has the initial balances that we expect' do
294
- expect(work.balance).to eq -Money.new(1_000_00)
295
- expect(cash.balance).to eq Money.new(100_00)
296
- expect(savings.balance).to eq Money.new(300_00)
297
- expect(store.balance).to eq Money.new(600_00)
298
- expect(btc_wallet.balance).to eq Money.new(200_00, 'BTC')
291
+ expect(work.balance).to eq(Money.new(-1_000_00))
292
+ expect(cash.balance).to eq(Money.new(100_00))
293
+ expect(savings.balance).to eq(Money.new(300_00))
294
+ expect(store.balance).to eq(Money.new(600_00))
295
+ expect(btc_wallet.balance).to eq(Money.new(200_00, 'BTC'))
299
296
  end
300
297
 
301
298
  it 'should have correct account balance records' do
302
299
  [work, cash, savings, store, btc_wallet].each do |account|
303
- expect(DoubleEntry::AccountBalance.find_by_account(account).balance).to eq account.balance
300
+ expect(DoubleEntry::AccountBalance.find_by_account(account).balance).to eq(account.balance)
304
301
  end
305
302
  end
306
303
 
307
304
  it 'should have correct account balance currencies' do
308
- expect(DoubleEntry::AccountBalance.find_by_account(btc_wallet).balance.currency).to eq 'BTC'
305
+ expect(DoubleEntry::AccountBalance.find_by_account(btc_wallet).balance.currency).to eq('BTC')
309
306
  end
310
307
 
311
308
  it 'affects origin/destination balance after transfer' do
@@ -315,20 +312,20 @@ describe DoubleEntry do
315
312
 
316
313
  DoubleEntry.transfer(amount, :from => savings, :code => :xfer, :to => cash)
317
314
 
318
- expect(savings.balance).to eq savings_balance - amount
319
- expect(cash.balance).to eq cash_balance + amount
315
+ expect(savings.balance).to eq(savings_balance - amount)
316
+ expect(cash.balance).to eq(cash_balance + amount)
320
317
  end
321
318
 
322
319
  it 'can be queried at a given point in time' do
323
- expect(cash.balance(:at => 1.week.ago)).to eq Money.new(100_00)
320
+ expect(cash.balance(:at => 1.week.ago)).to eq(Money.new(100_00))
324
321
  end
325
322
 
326
323
  it 'can be queries between two points in time' do
327
- expect(cash.balance(:from => 3.weeks.ago, :to => 2.weeks.ago)).to eq Money.new(500_00)
324
+ expect(cash.balance(:from => 3.weeks.ago, :to => 2.weeks.ago)).to eq(Money.new(500_00))
328
325
  end
329
326
 
330
327
  it 'can be queried between two points in time, even in the future' do
331
- expect(btc_wallet.balance(:from => Time.now, :to => 2.weeks.from_now)).to eq Money.new(200_00, 'BTC')
328
+ expect(btc_wallet.balance(:from => Time.now, :to => 2.weeks.from_now)).to eq(Money.new(200_00, 'BTC'))
332
329
  end
333
330
 
334
331
  it 'can report on balances, scoped by code' do
@@ -336,18 +333,18 @@ describe DoubleEntry do
336
333
  end
337
334
 
338
335
  it 'can report on balances, scoped by many codes' do
339
- expect(store.balance(:codes => [:layby, :deposit])).to eq Money.new(200_00)
336
+ expect(store.balance(:codes => [:layby, :deposit])).to eq(Money.new(200_00))
340
337
  end
341
338
 
342
339
  it 'has running balances for each line' do
343
340
  lines = lines_for_account(cash)
344
- expect(lines[0].balance).to eq Money.new(1_000_00) # salary
345
- expect(lines[1].balance).to eq Money.new(500_00) # savings
346
- expect(lines[2].balance).to eq Money.new(300_00) # purchase
347
- expect(lines[3].balance).to eq Money.new(200_00) # layby
348
- expect(lines[4].balance).to eq Money.new(100_00) # deposit
349
- expect(lines[5].balance).to eq Money.new(300_00) # savings
350
- expect(lines[6].balance).to eq Money.new(100_00) # purchase
341
+ expect(lines[0].balance).to eq(Money.new(1_000_00)) # salary
342
+ expect(lines[1].balance).to eq(Money.new(500_00)) # savings
343
+ expect(lines[2].balance).to eq(Money.new(300_00)) # purchase
344
+ expect(lines[3].balance).to eq(Money.new(200_00)) # layby
345
+ expect(lines[4].balance).to eq(Money.new(100_00)) # deposit
346
+ expect(lines[5].balance).to eq(Money.new(300_00)) # savings
347
+ expect(lines[6].balance).to eq(Money.new(100_00)) # purchase
351
348
  end
352
349
  end
353
350
 
@@ -384,32 +381,32 @@ describe DoubleEntry do
384
381
  it 'treats each separately scoped account having their own separate balances' do
385
382
  DoubleEntry.transfer(Money.new(20_00), :from => bank, :to => johns_cash, :code => :xfer)
386
383
  DoubleEntry.transfer(Money.new(10_00), :from => bank, :to => ryans_cash, :code => :xfer)
387
- expect(johns_cash.balance).to eq Money.new(20_00)
388
- expect(ryans_cash.balance).to eq Money.new(10_00)
384
+ expect(johns_cash.balance).to eq(Money.new(20_00))
385
+ expect(ryans_cash.balance).to eq(Money.new(10_00))
389
386
  end
390
387
 
391
388
  it 'allows transfer between two separately scoped accounts' do
392
389
  DoubleEntry.transfer(Money.new(10_00), :from => ryans_cash, :to => johns_cash, :code => :xfer)
393
- expect(ryans_cash.balance).to eq -Money.new(10_00)
394
- expect(johns_cash.balance).to eq Money.new(10_00)
390
+ expect(ryans_cash.balance).to eq(Money.new(-10_00))
391
+ expect(johns_cash.balance).to eq(Money.new(10_00))
395
392
  end
396
393
 
397
394
  it 'reports balance correctly if called from either account or finances object' do
398
395
  DoubleEntry.transfer(Money.new(10_00), :from => ryans_cash, :to => johns_cash, :code => :xfer)
399
- expect(ryans_cash.balance).to eq -Money.new(10_00)
400
- expect(DoubleEntry.balance(:cash, :scope => ryan)).to eq -Money.new(10_00)
396
+ expect(ryans_cash.balance).to eq(Money.new(-10_00))
397
+ expect(DoubleEntry.balance(:cash, :scope => ryan)).to eq(Money.new(-10_00))
401
398
  end
402
399
 
403
400
  it 'raises an exception if you try to scope with an object instance of differing class to that defined on the account' do
404
401
  not_a_user = double(:id => 7)
405
402
 
406
- expect {
403
+ expect do
407
404
  DoubleEntry.account(:savings, :scope => not_a_user)
408
- }.to raise_error DoubleEntry::AccountScopeMismatchError
405
+ end.to raise_error DoubleEntry::AccountScopeMismatchError
409
406
 
410
- expect {
407
+ expect do
411
408
  DoubleEntry.balance(:savings, :scope => not_a_user)
412
- }.to raise_error DoubleEntry::AccountScopeMismatchError
409
+ end.to raise_error DoubleEntry::AccountScopeMismatchError
413
410
  end
414
411
 
415
412
  it 'raises exception if you try to transfer between the same account, despite it being scoped' do
@@ -420,8 +417,8 @@ describe DoubleEntry do
420
417
 
421
418
  it 'allows transfer from one persons account to the same persons other kind of account' do
422
419
  DoubleEntry.transfer(Money.new(100_00), :from => ryans_cash, :to => ryans_savings, :code => :xfer)
423
- expect(ryans_cash.balance).to eq -Money.new(100_00)
424
- expect(ryans_savings.balance).to eq Money.new(100_00)
420
+ expect(ryans_cash.balance).to eq(Money.new(-100_00))
421
+ expect(ryans_savings.balance).to eq(Money.new(100_00))
425
422
  end
426
423
 
427
424
  it 'disallows you to report on scoped accounts globally' do
@@ -1,13 +1,11 @@
1
- require 'spec_helper'
2
1
  require 'action_controller'
3
2
  require 'generator_spec/test_case'
4
3
  require 'generators/double_entry/install/install_generator'
5
4
 
6
-
7
- describe DoubleEntry::Generators::InstallGenerator do
5
+ RSpec.describe DoubleEntry::Generators::InstallGenerator do
8
6
  include GeneratorSpec::TestCase
9
7
 
10
- destination File.expand_path("../../../../../tmp", __FILE__)
8
+ destination File.expand_path('../../../../../tmp', __FILE__)
11
9
 
12
10
  before do
13
11
  prepare_destination
@@ -15,10 +13,10 @@ describe DoubleEntry::Generators::InstallGenerator do
15
13
  end
16
14
 
17
15
  specify do
18
- expect(destination_root).to have_structure {
19
- directory "db" do
20
- directory "migrate" do
21
- migration "create_double_entry_tables" do
16
+ expect(destination_root).to have_structure do
17
+ directory 'db' do
18
+ directory 'migrate' do
19
+ migration 'create_double_entry_tables' do
22
20
  contains 'class CreateDoubleEntryTable'
23
21
  contains 'create_table "double_entry_account_balances"'
24
22
  contains 'create_table "double_entry_lines"'
@@ -27,7 +25,6 @@ describe DoubleEntry::Generators::InstallGenerator do
27
25
  end
28
26
  end
29
27
  end
30
- }
28
+ end
31
29
  end
32
-
33
30
  end
data/spec/spec_helper.rb CHANGED
@@ -9,12 +9,12 @@ FileUtils.mkdir_p 'tmp'
9
9
  FileUtils.mkdir_p 'log'
10
10
  FileUtils.rm 'log/test.log', :force => true
11
11
 
12
- database_config_file = File.expand_path("../support/database.yml", __FILE__)
13
- if File.exists?(database_config_file)
12
+ database_config_file = File.expand_path('../support/database.yml', __FILE__)
13
+ if File.exist?(database_config_file)
14
14
  ActiveRecord::Base.establish_connection YAML.load_file(database_config_file)[db_engine]
15
15
  else
16
- puts "Please configure your spec/support/database.yml file."
17
- puts "See spec/support/database.example.yml"
16
+ puts 'Please configure your spec/support/database.yml file.'
17
+ puts 'See spec/support/database.example.yml'
18
18
  exit 1
19
19
  end
20
20
 
@@ -28,16 +28,74 @@ end
28
28
 
29
29
  I18n.config.enforce_available_locales = false
30
30
 
31
+ silence_warnings do
32
+ require 'rspec'
33
+ require 'rspec/its'
34
+ require 'database_cleaner'
35
+ require 'machinist/active_record'
36
+ require 'timecop'
37
+ require 'money'
38
+ end
39
+
31
40
  require 'double_entry'
32
- require 'rspec'
33
- require 'rspec/its'
34
- require 'database_cleaner'
35
- require 'machinist/active_record'
36
- require 'timecop'
37
41
 
38
- Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f }
42
+ Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f }
39
43
 
40
44
  RSpec.configure do |config|
45
+ # rspec-expectations config goes here. You can use an alternate
46
+ # assertion/expectation library such as wrong or the stdlib/minitest
47
+ # assertions if you prefer.
48
+ config.expect_with :rspec do |expectations|
49
+ # This option will default to `true` in RSpec 4. It makes the `description`
50
+ # and `failure_message` of custom matchers include text for helper methods
51
+ # defined using `chain`, e.g.:
52
+ # be_bigger_than(2).and_smaller_than(4).description
53
+ # # => "be bigger than 2 and smaller than 4"
54
+ # ...rather than:
55
+ # # => "be bigger than 2"
56
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
57
+ end
58
+
59
+ # rspec-mocks config goes here. You can use an alternate test double
60
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
61
+ config.mock_with :rspec do |mocks|
62
+ # Prevents you from mocking or stubbing a method that does not exist on
63
+ # a real object. This is generally recommended, and will default to
64
+ # `true` in RSpec 4.
65
+ mocks.verify_partial_doubles = true
66
+ end
67
+
68
+ # These two settings work together to allow you to limit a spec run
69
+ # to individual examples or groups you care about by tagging them with
70
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
71
+ # get run.
72
+ config.filter_run :focus
73
+ config.run_all_when_everything_filtered = true
74
+
75
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
76
+ # For more details, see:
77
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
78
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
79
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
80
+ config.disable_monkey_patching!
81
+
82
+ # Many RSpec users commonly either run the entire suite or an individual
83
+ # file, and it's useful to allow more verbose output when running an
84
+ # individual spec file.
85
+ if config.files_to_run.one?
86
+ # Use the documentation formatter for detailed output,
87
+ # unless a formatter has already been configured
88
+ # (e.g. via a command-line flag).
89
+ config.default_formatter = 'doc'
90
+ else
91
+ config.default_formatter = 'RSpec::Instafail'
92
+ end
93
+
94
+ # Print the 5 slowest examples and example groups at the
95
+ # end of the spec run, to help surface which specs are running
96
+ # particularly slow.
97
+ config.profile_examples = 5
98
+
41
99
  config.include DoubleEntrySpecHelper
42
100
 
43
101
  config.before(:suite) do