tripletexer 0.1.2 → 0.2.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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -1
  3. data/lib/tripletexer.rb +23 -28
  4. data/lib/tripletexer/api_client.rb +95 -0
  5. data/lib/tripletexer/endpoints/abstract_endpoint.rb +12 -62
  6. data/lib/tripletexer/endpoints/customer.rb +1 -1
  7. data/lib/tripletexer/endpoints/employee.rb +1 -1
  8. data/lib/tripletexer/endpoints/invoice.rb +4 -4
  9. data/lib/tripletexer/endpoints/ledger.rb +10 -10
  10. data/lib/tripletexer/endpoints/ledger/close_group.rb +2 -2
  11. data/lib/tripletexer/endpoints/ledger/posting.rb +2 -2
  12. data/lib/tripletexer/endpoints/ledger/voucher.rb +2 -2
  13. data/lib/tripletexer/endpoints/order.rb +5 -5
  14. data/lib/tripletexer/endpoints/project.rb +1 -1
  15. data/lib/tripletexer/endpoints/timesheet.rb +2 -2
  16. data/lib/tripletexer/endpoints/timesheet/entry.rb +2 -2
  17. data/lib/tripletexer/endpoints/timesheet/time_clock.rb +2 -2
  18. data/lib/tripletexer/endpoints/token.rb +2 -2
  19. data/lib/tripletexer/endpoints/token/session.rb +7 -7
  20. data/lib/tripletexer/format_helpers.rb +8 -5
  21. data/lib/tripletexer/version.rb +1 -1
  22. data/spec/client_spec.rb +56 -0
  23. data/spec/endpoints/order_spec.rb +50 -0
  24. data/spec/endpoints/timesheet_spec.rb +19 -0
  25. data/spec/endpoints/token/session_spec.rb +33 -0
  26. data/spec/endpoints/token_spec.rb +19 -0
  27. data/spec/format_helpers_spec.rb +55 -0
  28. data/spec/spec_helper.rb +111 -0
  29. data/spec/tripletexer_spec.rb +114 -0
  30. data/spec/vcr_cassettes/endpoints/order/find.yml +116 -0
  31. data/spec/vcr_cassettes/endpoints/order/find__unauthorized.yml +71 -0
  32. data/spec/vcr_cassettes/endpoints/order/search.yml +164 -0
  33. data/spec/vcr_cassettes/endpoints/token/session/create.yml +77 -0
  34. data/spec/vcr_cassettes/endpoints/token/session/destroy.yml +295 -0
  35. data/spec/vcr_cassettes/endpoints/token/session/whoami.yml +68 -0
  36. data/spec/web_helper.rb +20 -0
  37. metadata +162 -16
  38. data/lib/tripletexer/connection.rb +0 -49
@@ -5,8 +5,8 @@ module Tripletexer::Endpoints
5
5
  # https://tripletex.no/v2-docs/#!/ledger47closeGroup/search
6
6
  def search(date_from, date_to, params = {})
7
7
  final_params = params.merge(
8
- 'dateFrom' => format_date(date_from),
9
- 'dateTo' => format_date(date_to)
8
+ 'dateFrom' => ::Tripletexer::FormatHelpers.format_date(date_from),
9
+ 'dateTo' => ::Tripletexer::FormatHelpers.format_date(date_to)
10
10
  )
11
11
  find_entities('/v2/ledger/closeGroup', final_params)
12
12
  end
@@ -6,8 +6,8 @@ module Tripletexer::Endpoints
6
6
  # https://tripletex.no/v2-docs/#!/ledger47posting/search
7
7
  def search(date_from, date_to, params = {})
8
8
  final_params = params.merge(
9
- 'dateFrom' => format_date(date_from),
10
- 'dateTo' => format_date(date_to)
9
+ 'dateFrom' => ::Tripletexer::FormatHelpers.format_date(date_from),
10
+ 'dateTo' => ::Tripletexer::FormatHelpers.format_date(date_to)
11
11
  )
12
12
  find_entities('/v2/ledger/posting', final_params)
13
13
  end
@@ -6,8 +6,8 @@ module Tripletexer::Endpoints
6
6
  # https://tripletex.no/v2-docs/#!/ledger47voucher/search
7
7
  def search(date_from, date_to, params = {})
8
8
  final_params = params.merge(
9
- 'invoiceDateFrom' => format_date(date_from),
10
- 'invoiceDateTo' => format_date(date_to)
9
+ 'invoiceDateFrom' => ::Tripletexer::FormatHelpers.format_date(date_from),
10
+ 'invoiceDateTo' => ::Tripletexer::FormatHelpers.format_date(date_to)
11
11
  )
12
12
  find_entities('/v2/ledger/voucher', final_params)
13
13
  end
@@ -6,8 +6,8 @@ module Tripletexer::Endpoints
6
6
  # https://tripletex.no/v2-docs/#!/order/search
7
7
  def search(date_from, date_to, params = {})
8
8
  final_params = params.merge(
9
- 'orderDateFrom' => format_date(date_from),
10
- 'orderDateTo' => format_date(date_to)
9
+ 'orderDateFrom' => ::Tripletexer::FormatHelpers.format_date(date_from),
10
+ 'orderDateTo' => ::Tripletexer::FormatHelpers.format_date(date_to)
11
11
  )
12
12
  find_entities('/v2/order', final_params)
13
13
  end
@@ -30,14 +30,14 @@ module Tripletexer::Endpoints
30
30
  # https://tripletex.no/v2-docs/#!/order/invoice
31
31
  def create_invoice(id, invoice_date, send_to_customer = true)
32
32
  final_params = params.merge(
33
- 'invoiceDate' => format_date(invoice_date),
33
+ 'invoiceDate' => ::Tripletexer::FormatHelpers.format_date(invoice_date),
34
34
  'sendToCustomer' => send_to_customer.to_s
35
35
  )
36
- put("/v2/order/#{id}", final_params)
36
+ api_client.put("/v2/order/#{id}", final_params)
37
37
  end
38
38
 
39
39
  def orderline
40
- ::Tripletexer::Endpoints::Order::Orderline.new(connection)
40
+ ::Tripletexer::Endpoints::Order::Orderline.new(api_client)
41
41
  end
42
42
  end
43
43
  end
@@ -19,7 +19,7 @@ module Tripletexer::Endpoints
19
19
  end
20
20
 
21
21
  def category
22
- Tripletexer::Endpoints::Project::Category.new(connection)
22
+ Tripletexer::Endpoints::Project::Category.new(api_client)
23
23
  end
24
24
 
25
25
  end
@@ -3,11 +3,11 @@
3
3
  module Tripletexer::Endpoints
4
4
  class Timesheet < AbstractEndpoint
5
5
  def entry
6
- Tripletexer::Endpoints::Timesheet::Entry.new(connection)
6
+ Tripletexer::Endpoints::Timesheet::Entry.new(api_client)
7
7
  end
8
8
 
9
9
  def time_clock
10
- Tripletexer::Endpoints::Timesheet::TimeClock.new(connection)
10
+ Tripletexer::Endpoints::Timesheet::TimeClock.new(api_client)
11
11
  end
12
12
  end
13
13
  end
@@ -6,8 +6,8 @@ module Tripletexer::Endpoints
6
6
  # https://tripletex.no/v2-docs/#!/timesheet47entry/search
7
7
  def search(from_date, to_date, params = {})
8
8
  final_params = params.merge(
9
- 'dateFrom' => format_date(from_date),
10
- 'dateTo' => format_date(to_date)
9
+ 'dateFrom' => ::Tripletexer::FormatHelpers.format_date(from_date),
10
+ 'dateTo' => ::Tripletexer::FormatHelpers.format_date(to_date)
11
11
  )
12
12
  find_entities('/v2/timesheet/entry', final_params)
13
13
  end
@@ -13,7 +13,7 @@ module Tripletexer::Endpoints
13
13
  final_params = params.merge(
14
14
  'activityId' => activity_id
15
15
  )
16
- put('/timesheet/timeClock/:start', final_params)
16
+ api_client.put('/timesheet/timeClock/:start', final_params)
17
17
  end
18
18
 
19
19
  # https://tripletex.no/v2-docs/#!/timesheet47timeClock/getPresent
@@ -33,7 +33,7 @@ module Tripletexer::Endpoints
33
33
 
34
34
  # https://tripletex.no/v2-docs/#!/timesheet47timeClock/stop
35
35
  def stop(id, params = {})
36
- put("/timesheet/timeClock/#{id}/:stop", params)
36
+ api_client.put("/timesheet/timeClock/#{id}/:stop", params)
37
37
  end
38
38
  end
39
39
  end
@@ -3,11 +3,11 @@
3
3
  module Tripletexer::Endpoints
4
4
  class Token < AbstractEndpoint
5
5
  def consumer
6
- ::Tripletexer::Endpoints::Token::Consumer.new(connection)
6
+ ::Tripletexer::Endpoints::Token::Consumer.new(api_client)
7
7
  end
8
8
 
9
9
  def session
10
- ::Tripletexer::Endpoints::Token::Session.new(connection)
10
+ ::Tripletexer::Endpoints::Token::Session.new(api_client)
11
11
  end
12
12
  end
13
13
  end
@@ -6,15 +6,15 @@ module Tripletexer::Endpoints
6
6
 
7
7
  # https://tripletex.no/v2-docs/#!/token47session/create
8
8
  def create(consumer_token, employee_token, expiration_date: Time.now.utc + DAY_IN_SECONDS)
9
- response = put('/v2/token/session/:create') do |req|
9
+ response = api_client.put('/v2/token/session/:create') do |req|
10
10
  req.params = {
11
11
  'consumerToken' => consumer_token,
12
12
  'employeeToken' => employee_token,
13
- 'expirationDate' => format_date(expiration_date)
13
+ 'expirationDate' => ::Tripletexer::FormatHelpers.format_date(expiration_date)
14
14
  }
15
15
  end
16
- connection.token = response.dig('value', 'token')
17
- response
16
+ api_client.session_token = response['value']['token']
17
+ response['value']
18
18
  end
19
19
 
20
20
  # https://tripletex.no/v2-docs/#!/token47session/whoAmI
@@ -23,9 +23,9 @@ module Tripletexer::Endpoints
23
23
  end
24
24
 
25
25
  # https://tripletex.no/v2-docs/#!/token47session/delete
26
- def destroy(token = connection.token)
27
- response = delete("/v2/token/session/#{token}")
28
- connection.reset
26
+ def destroy(session_token = api_client.session_token)
27
+ response = api_client.delete("/v2/token/session/#{session_token}")
28
+ api_client.reset_connection
29
29
  response
30
30
  end
31
31
  end
@@ -1,12 +1,15 @@
1
1
  module Tripletexer::FormatHelpers
2
- def format_date(value)
3
- return value if value.is_a? String
4
- value.to_date.to_s
2
+ def self.format_date(value)
3
+ return nil if value.nil?
4
+ return value.to_date.to_s if value.respond_to?(:to_date)
5
+ raise TypeError, 'value must be Date, Time or String' unless value.is_a?(String)
6
+ return value if value =~ /\A\d{4}-[01]\d-[0-3]\d\z/
7
+ raise ArgumentError, 'invalid date format, must be YYYY-MM-DD'
5
8
  end
6
9
 
7
- def normalize_body(body)
10
+ def self.normalize_body(body)
8
11
  return body if body.is_a?(String)
9
12
  return JSON.dump(body) if body.is_a?(Hash) || body.is_a?(Array)
10
- raise ArtumentError, 'unsupported body type'
13
+ raise ArgumentError, 'unsupported body type'
11
14
  end
12
15
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Tripletexer
4
- VERSION = '0.1.2'
4
+ VERSION = '0.2.0'
5
5
  API_VERSION = '2.1.2'
6
6
  end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Tripletexer::APIClient do
6
+ describe '#connection' do
7
+ it 'returns new Faraday connection' do
8
+ expect( subject.connection ).to be_an_instance_of Faraday::Connection
9
+ end
10
+
11
+ context "when #session_token isn't set" do
12
+ it 'returns new connection every time' do
13
+ subject.session_token = nil
14
+ expect( subject.connection.object_id ).to_not eq subject.connection.object_id
15
+ end
16
+ end
17
+
18
+ context 'when #session_token is set' do
19
+ it 'reuses connection' do
20
+ subject.session_token = 'token'
21
+ expect( subject.connection.object_id ).to eq subject.connection.object_id
22
+ end
23
+ end
24
+ end
25
+
26
+ describe '#reset_connection' do
27
+ before do
28
+ subject.session_token = 'token'
29
+ subject.connection
30
+ end
31
+
32
+ it 'destroys session_token' do
33
+ expect { subject.reset_connection }.to change { subject.session_token }.to(nil)
34
+ end
35
+
36
+ it 'destroys cached connection' do
37
+ expect { subject.reset_connection }.to change { subject.connection.object_id }
38
+ end
39
+ end
40
+
41
+ describe '#session_token=' do
42
+ before do
43
+ subject.session_token = 'token'
44
+ subject.connection
45
+ end
46
+
47
+ it 'destroys cached connection' do
48
+ expect { subject.session_token = 'new_token' }.to change { subject.connection.object_id }
49
+ end
50
+
51
+ it 'changes session token to given token' do
52
+ expect { subject.session_token = 'new_token' }.to change { subject.session_token }.to('new_token')
53
+ end
54
+ end
55
+
56
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'web_helper'
4
+
5
+ RSpec.describe Tripletexer::Endpoints::Order do
6
+ subject { Tripletexer.new(session_token: ENV['SESSION_TOKEN']).order }
7
+
8
+ describe '#search' do
9
+ it 'returns enumerator', vcr: 'endpoints/order/search' do
10
+ response = subject.search(Date.new(2017), Date.new(2018, 9, 26))
11
+ expect( response ).to be_an_instance_of Enumerator
12
+ end
13
+
14
+ it 'returns two orders', vcr: 'endpoints/order/search' do
15
+ response = subject.search(Date.new(2017), Date.new(2018, 9, 26)).to_a
16
+ expect( response.size ).to eq 2
17
+ expect( response[0]['id'] ).to eq 23432678
18
+ end
19
+ end
20
+
21
+ describe '#create' do
22
+ it 'has no test yet'
23
+ end
24
+
25
+ describe '#find' do
26
+ it 'returns order with given id', vcr: 'endpoints/order/find' do
27
+ response = subject.find(23432678)
28
+ expect( response ).to include('id' => 23432678)
29
+ end
30
+
31
+ it 'raises Tripletexer::Errors::Unauthorized when user has no access to order', vcr: 'endpoints/order/find__unauthorized' do
32
+ expect { subject.find(23432677) }.to raise_error Tripletexer::Errors::Unauthorized
33
+ end
34
+ end
35
+
36
+ describe '#update' do
37
+ it 'has no test yet'
38
+ end
39
+
40
+ describe '#create_invoice' do
41
+ it 'has no test yet'
42
+ end
43
+
44
+ describe 'orderline' do
45
+ it 'returns order/orderline endpoint' do
46
+ expect( subject.orderline ).to be_an_instance_of ::Tripletexer::Endpoints::Order::Orderline
47
+ end
48
+ end
49
+
50
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Tripletexer::Endpoints::Timesheet do
6
+ subject { Tripletexer.new.timesheet }
7
+
8
+ describe "#entry" do
9
+ it 'returns token/consumer endpoint' do
10
+ expect( subject.entry ).to be_an_instance_of ::Tripletexer::Endpoints::Timesheet::Entry
11
+ end
12
+ end
13
+
14
+ describe "#time_clock" do
15
+ it 'returns token/time_clock endpoint' do
16
+ expect( subject.time_clock ).to be_an_instance_of ::Tripletexer::Endpoints::Timesheet::TimeClock
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'web_helper'
4
+
5
+ RSpec.describe Tripletexer::Endpoints::Token::Session do
6
+
7
+ describe '#create' do
8
+ subject { Tripletexer.new.token.session }
9
+ it 'creates new session and sets session_token for connection', vcr: 'endpoints/token/session/create' do
10
+ response = subject.create(ENV['CONSUMER_SECRET'], ENV['EMPLOYEE_TOKEN'])
11
+ expect( subject.send(:api_client).session_token ).to eq response['token']
12
+ end
13
+ end
14
+
15
+ describe '#whoami' do
16
+ subject { Tripletexer.new(session_token: ENV['SESSION_TOKEN']).token.session }
17
+
18
+ it 'returns info about session', vcr: 'endpoints/token/session/whoami' do
19
+ expect( subject.whoami ).to eq("employeeId" => 1133333, "companyId" => 3795625)
20
+ end
21
+ end
22
+
23
+ describe '#destroy' do
24
+ subject { Tripletexer.new.token.session }
25
+ it 'destroys session', vcr: 'endpoints/token/session/destroy' do
26
+ expect { subject.whoami }.to raise_error ::Tripletexer::Errors::Unauthorized
27
+ subject.create(ENV['CONSUMER_SECRET'], ENV['EMPLOYEE_TOKEN'])
28
+ expect { subject.whoami }.to_not raise_error
29
+ expect( subject.destroy ).to eq ''
30
+ expect { subject.whoami }.to raise_error ::Tripletexer::Errors::Unauthorized
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Tripletexer::Endpoints::Token do
6
+ subject { Tripletexer.new.token }
7
+
8
+ describe "#consumer" do
9
+ it 'returns token/consumer endpoint' do
10
+ expect( subject.consumer ).to be_an_instance_of ::Tripletexer::Endpoints::Token::Consumer
11
+ end
12
+ end
13
+
14
+ describe "#session" do
15
+ it 'returns token/session endpoint' do
16
+ expect( subject.session ).to be_an_instance_of ::Tripletexer::Endpoints::Token::Session
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'date'
5
+
6
+ RSpec.describe Tripletexer::FormatHelpers do
7
+ subject { described_class }
8
+
9
+ describe '.format_date' do
10
+ it 'returns nil when given nil' do
11
+ expect( subject.format_date(nil) ).to be_nil
12
+ end
13
+
14
+ it 'returns date string when given date' do
15
+ expect( subject.format_date(Date.new(2016, 5, 1)) ).to eq '2016-05-01'
16
+ end
17
+
18
+ it 'returns date string when given time' do
19
+ expect( subject.format_date(Time.new(2013, 5, 4, 12, 12, 15)) ).to eq '2013-05-04'
20
+ end
21
+
22
+ it 'raises TypeError when given unsupported object' do
23
+ expect { subject.format_date({}) }.to raise_error(TypeError, 'value must be Date, Time or String')
24
+ end
25
+
26
+ it 'returns date string when given date string' do
27
+ expect( subject.format_date('2018-07-09') ).to eq '2018-07-09'
28
+ end
29
+
30
+ it "raises ArgumentError when given string doesn't look valid" do
31
+ expect { subject.format_date('foo') }.to raise_error(ArgumentError, 'invalid date format, must be YYYY-MM-DD')
32
+ expect { subject.format_date('2017-99-99') }.to raise_error(ArgumentError, 'invalid date format, must be YYYY-MM-DD')
33
+ end
34
+ end
35
+
36
+ describe '.normalize_body' do
37
+ it 'returns given string' do
38
+ expect( subject.normalize_body('test') ).to eq 'test'
39
+ end
40
+
41
+ it 'returns JSON string of given hash' do
42
+ expect( subject.normalize_body({foo: :bar}) ).to eq '{"foo":"bar"}'
43
+ end
44
+
45
+ it 'returns JSON string of given array' do
46
+ expect( subject.normalize_body(['foo', 1, 'bar']) ).to eq '["foo",1,"bar"]'
47
+ end
48
+
49
+ it 'raises ArgumentError when different object is given' do
50
+ expect { subject.normalize_body(1) }.to raise_error(ArgumentError, 'unsupported body type')
51
+ expect { subject.normalize_body(:foo) }.to raise_error(ArgumentError, 'unsupported body type')
52
+ expect { subject.normalize_body(Object.new) }.to raise_error(ArgumentError, 'unsupported body type')
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,111 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ require 'simplecov'
5
+ SimpleCov.start do
6
+ add_filter %r{^/spec/}
7
+ add_group 'Endpoints', 'lib/tripletexer/endpoints'
8
+ end
9
+ require 'dotenv/load'
10
+ require 'tripletexer'
11
+
12
+ # This file was generated by the `rspec --init` command. Conventionally, all
13
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
14
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
15
+ # this file to always be loaded, without a need to explicitly require it in any
16
+ # files.
17
+ #
18
+ # Given that it is always loaded, you are encouraged to keep this file as
19
+ # light-weight as possible. Requiring heavyweight dependencies from this file
20
+ # will add to the boot time of your test suite on EVERY test run, even for an
21
+ # individual file that may not need all of that loaded. Instead, consider making
22
+ # a separate helper file that requires the additional dependencies and performs
23
+ # the additional setup, and require it from the spec files that actually need
24
+ # it.
25
+ #
26
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
27
+ RSpec.configure do |config|
28
+ # rspec-expectations config goes here. You can use an alternate
29
+ # assertion/expectation library such as wrong or the stdlib/minitest
30
+ # assertions if you prefer.
31
+ config.expect_with :rspec do |expectations|
32
+ # This option will default to `true` in RSpec 4. It makes the `description`
33
+ # and `failure_message` of custom matchers include text for helper methods
34
+ # defined using `chain`, e.g.:
35
+ # be_bigger_than(2).and_smaller_than(4).description
36
+ # # => "be bigger than 2 and smaller than 4"
37
+ # ...rather than:
38
+ # # => "be bigger than 2"
39
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
40
+ end
41
+
42
+ # rspec-mocks config goes here. You can use an alternate test double
43
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
44
+ config.mock_with :rspec do |mocks|
45
+ # Prevents you from mocking or stubbing a method that does not exist on
46
+ # a real object. This is generally recommended, and will default to
47
+ # `true` in RSpec 4.
48
+ mocks.verify_partial_doubles = true
49
+ end
50
+
51
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
52
+ # have no way to turn it off -- the option exists only for backwards
53
+ # compatibility in RSpec 3). It causes shared context metadata to be
54
+ # inherited by the metadata hash of host groups and examples, rather than
55
+ # triggering implicit auto-inclusion in groups with matching metadata.
56
+ config.shared_context_metadata_behavior = :apply_to_host_groups
57
+
58
+ # The settings below are suggested to provide a good initial experience
59
+ # with RSpec, but feel free to customize to your heart's content.
60
+ =begin
61
+ # This allows you to limit a spec run to individual examples or groups
62
+ # you care about by tagging them with `:focus` metadata. When nothing
63
+ # is tagged with `:focus`, all examples get run. RSpec also provides
64
+ # aliases for `it`, `describe`, and `context` that include `:focus`
65
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
66
+ config.filter_run_when_matching :focus
67
+
68
+ # Allows RSpec to persist some state between runs in order to support
69
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
70
+ # you configure your source control system to ignore this file.
71
+ config.example_status_persistence_file_path = "spec/examples.txt"
72
+
73
+ # Limits the available syntax to the non-monkey patched syntax that is
74
+ # recommended. For more details, see:
75
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
76
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
77
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
78
+ config.disable_monkey_patching!
79
+
80
+ # This setting enables warnings. It's recommended, but in some cases may
81
+ # be too noisy due to issues in dependencies.
82
+ config.warnings = true
83
+
84
+ # Many RSpec users commonly either run the entire suite or an individual
85
+ # file, and it's useful to allow more verbose output when running an
86
+ # individual spec file.
87
+ if config.files_to_run.one?
88
+ # Use the documentation formatter for detailed output,
89
+ # unless a formatter has already been configured
90
+ # (e.g. via a command-line flag).
91
+ config.default_formatter = "doc"
92
+ end
93
+
94
+ # Print the 10 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 = 10
98
+
99
+ # Run specs in random order to surface order dependencies. If you find an
100
+ # order dependency and want to debug it, you can fix the order by providing
101
+ # the seed, which is printed after each run.
102
+ # --seed 1234
103
+ config.order = :random
104
+
105
+ # Seed global randomization in this process using the `--seed` CLI option.
106
+ # Setting this allows you to use `--seed` to deterministically reproduce
107
+ # test failures related to randomization by passing the same `--seed` value
108
+ # as the one that triggered the failure.
109
+ Kernel.srand config.seed
110
+ =end
111
+ end