patch_ruby 1.6.0 → 1.10.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/Gemfile +1 -2
- data/Gemfile.lock +23 -28
- data/bin/rspec +29 -0
- data/lib/patch_ruby/api/estimates_api.rb +97 -24
- data/lib/patch_ruby/api/orders_api.rb +30 -16
- data/lib/patch_ruby/api/preferences_api.rb +17 -13
- data/lib/patch_ruby/api/projects_api.rb +9 -7
- data/lib/patch_ruby/api_client.rb +51 -49
- data/lib/patch_ruby/api_error.rb +1 -1
- data/lib/patch_ruby/configuration.rb +38 -9
- data/lib/patch_ruby/models/allocation.rb +21 -11
- data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +25 -19
- data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +269 -0
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +22 -13
- data/lib/patch_ruby/models/create_order_request.rb +21 -11
- data/lib/patch_ruby/models/create_preference_request.rb +21 -11
- data/lib/patch_ruby/models/error_response.rb +22 -13
- data/lib/patch_ruby/models/estimate.rb +23 -14
- data/lib/patch_ruby/models/estimate_list_response.rb +22 -13
- data/lib/patch_ruby/models/estimate_response.rb +22 -13
- data/lib/patch_ruby/models/meta_index_object.rb +23 -15
- data/lib/patch_ruby/models/order.rb +25 -17
- data/lib/patch_ruby/models/order_list_response.rb +22 -13
- data/lib/patch_ruby/models/order_response.rb +22 -13
- data/lib/patch_ruby/models/photo.rb +21 -11
- data/lib/patch_ruby/models/preference.rb +21 -11
- data/lib/patch_ruby/models/preference_list_response.rb +22 -13
- data/lib/patch_ruby/models/preference_response.rb +22 -13
- data/lib/patch_ruby/models/project.rb +24 -17
- data/lib/patch_ruby/models/project_list_response.rb +22 -13
- data/lib/patch_ruby/models/project_response.rb +22 -13
- data/lib/patch_ruby/models/sdg.rb +21 -11
- data/lib/patch_ruby/models/standard.rb +21 -11
- data/lib/patch_ruby/version.rb +2 -2
- data/lib/patch_ruby.rb +2 -1
- data/patch_ruby.gemspec +7 -3
- data/spec/api_client_spec.rb +34 -13
- data/spec/configuration_spec.rb +1 -1
- data/spec/integration/estimates_spec.rb +34 -7
- data/spec/integration/orders_spec.rb +15 -18
- data/spec/integration/preferences_spec.rb +1 -7
- data/spec/integration/projects_spec.rb +5 -17
- data/spec/models/create_mass_estimate_request_spec.rb +1 -1
- data/spec/models/error_response_spec.rb +1 -1
- data/spec/models/estimate_list_response_spec.rb +1 -1
- data/spec/models/estimate_response_spec.rb +1 -1
- data/spec/models/estimate_spec.rb +1 -1
- data/spec/models/meta_index_object_spec.rb +1 -1
- data/spec/models/order_list_response_spec.rb +1 -1
- data/spec/models/order_response_spec.rb +1 -1
- data/spec/models/order_spec.rb +1 -1
- data/spec/models/preference_list_response_spec.rb +1 -1
- data/spec/models/preference_response_spec.rb +1 -1
- data/spec/models/project_list_response_spec.rb +1 -1
- data/spec/models/project_response_spec.rb +1 -1
- data/spec/models/project_spec.rb +1 -1
- data/spec/spec_helper.rb +70 -54
- metadata +37 -41
data/spec/configuration_spec.rb
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
RSpec.describe 'Estimates Integration' do
|
|
2
|
-
before do
|
|
3
|
-
Patch.configure do |config|
|
|
4
|
-
config.access_token = ENV['SANDBOX_API_KEY']
|
|
5
|
-
end
|
|
6
|
-
end
|
|
7
|
-
|
|
8
2
|
it 'supports create, retrieve and list' do
|
|
9
3
|
create_estimate_response = Patch::Estimate.create_mass_estimate(mass_g: 100)
|
|
10
4
|
estimate_id = create_estimate_response.data.id
|
|
@@ -33,7 +27,7 @@ RSpec.describe 'Estimates Integration' do
|
|
|
33
27
|
)
|
|
34
28
|
|
|
35
29
|
expect(flight_estimate.data.type).to eq 'flight'
|
|
36
|
-
expect(flight_estimate.data.mass_g).to eq
|
|
30
|
+
expect(flight_estimate.data.mass_g).to eq 1_000_622
|
|
37
31
|
end
|
|
38
32
|
|
|
39
33
|
it 'supports creating vehicle estimates' do
|
|
@@ -99,4 +93,37 @@ RSpec.describe 'Estimates Integration' do
|
|
|
99
93
|
expect(bitcoin_estimate.data.type).to eq 'bitcoin'
|
|
100
94
|
expect(bitcoin_estimate.data.mass_g).to be < bitcoin_estimate_2.data.mass_g
|
|
101
95
|
end
|
|
96
|
+
|
|
97
|
+
it 'supports creating bitcoin estimates with a timestamp' do
|
|
98
|
+
bitcoin_estimate_1 = Patch::Estimate.create_bitcoin_estimate(
|
|
99
|
+
timestamp: '2021-06-01T20:31:18.403Z'
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
bitcoin_estimate_2 = Patch::Estimate.create_bitcoin_estimate(
|
|
103
|
+
timestamp: '2021-07-01T20:31:18.403Z'
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
expect(bitcoin_estimate_1.data.type).to eq 'bitcoin'
|
|
107
|
+
expect(bitcoin_estimate_1.data.mass_g).to be > bitcoin_estimate_2.data.mass_g # Bitcoin was emitting less in July 2021 than in June
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it 'supports creating ethereum estimates with a gas amount' do
|
|
111
|
+
ethereum_estimate = Patch::Estimate.create_ethereum_estimate(
|
|
112
|
+
gas_used: 100
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
ethereum_estimate_2 = Patch::Estimate.create_ethereum_estimate(
|
|
116
|
+
gas_used: 1000
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
expect(ethereum_estimate.data.type).to eq 'ethereum'
|
|
120
|
+
expect(ethereum_estimate.data.mass_g).to be < ethereum_estimate_2.data.mass_g
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it 'supports creating ethereum estimates with partial information' do
|
|
124
|
+
ethereum_estimate = Patch::Estimate.create_ethereum_estimate({ create_order: false })
|
|
125
|
+
|
|
126
|
+
expect(ethereum_estimate.data.type).to eq 'ethereum'
|
|
127
|
+
expect(ethereum_estimate.data.mass_g).to be >= 2_000
|
|
128
|
+
end
|
|
102
129
|
end
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
RSpec.describe 'Orders Integration' do
|
|
2
|
-
before do
|
|
3
|
-
Patch.configure do |config|
|
|
4
|
-
config.access_token = ENV['SANDBOX_API_KEY']
|
|
5
|
-
end
|
|
6
|
-
end
|
|
7
|
-
|
|
8
2
|
it 'supports create, place, cancel, retrieve and list' do
|
|
9
3
|
create_order_response = Patch::Order.create_order(mass_g: 100)
|
|
10
4
|
order_id = create_order_response.data.id
|
|
@@ -44,8 +38,8 @@ RSpec.describe 'Orders Integration' do
|
|
|
44
38
|
expect(create_order_response.success).to eq true
|
|
45
39
|
expect(order.id).not_to be_nil
|
|
46
40
|
expect(order.mass_g).to eq(order_mass_g)
|
|
47
|
-
expect(order.price_cents_usd
|
|
48
|
-
expect(order.patch_fee_cents_usd).
|
|
41
|
+
expect(order.price_cents_usd).to be_between(expected_price - 2, expected_price + 2)
|
|
42
|
+
expect(order.patch_fee_cents_usd).to be_kind_of(Integer)
|
|
49
43
|
expect(order.registry_url).not_to be_empty
|
|
50
44
|
end
|
|
51
45
|
|
|
@@ -55,7 +49,7 @@ RSpec.describe 'Orders Integration' do
|
|
|
55
49
|
)
|
|
56
50
|
|
|
57
51
|
project_id = retrieve_project_response.data.id
|
|
58
|
-
total_price_cents_usd =
|
|
52
|
+
total_price_cents_usd = 50_00
|
|
59
53
|
|
|
60
54
|
create_order_response = Patch::Order.create_order(
|
|
61
55
|
total_price_cents_usd: total_price_cents_usd,
|
|
@@ -67,25 +61,28 @@ RSpec.describe 'Orders Integration' do
|
|
|
67
61
|
order = create_order_response.data
|
|
68
62
|
|
|
69
63
|
expect(order.id).not_to be_nil
|
|
70
|
-
expect(order.
|
|
71
|
-
expect(order.mass_g).to be < 460_000
|
|
72
|
-
expect(order.price_cents_usd).not_to be_empty
|
|
73
|
-
expect(order.patch_fee_cents_usd).not_to be_empty
|
|
74
|
-
expect(
|
|
75
|
-
order.price_cents_usd.to_i + order.patch_fee_cents_usd.to_i
|
|
76
|
-
).to eq(total_price_cents_usd)
|
|
64
|
+
expect(order.price_cents_usd + order.patch_fee_cents_usd).to eq total_price_cents_usd
|
|
77
65
|
expect(order.registry_url).not_to be_empty
|
|
78
66
|
end
|
|
79
67
|
|
|
80
|
-
it 'supports
|
|
68
|
+
it 'supports creation with and querying by metadata' do
|
|
81
69
|
metadata = { user: 'john doe' }
|
|
82
70
|
|
|
83
|
-
create_order_response =
|
|
71
|
+
create_order_response =
|
|
72
|
+
Patch::Order.create_order(mass_g: 100, metadata: metadata)
|
|
84
73
|
|
|
85
74
|
expect(create_order_response.success).to eq true
|
|
86
75
|
expect(create_order_response.data.id).not_to be_nil
|
|
87
76
|
expect(create_order_response.data.mass_g).to eq(100)
|
|
88
77
|
expect(create_order_response.data.metadata).to eq(metadata)
|
|
78
|
+
|
|
79
|
+
retrieve_orders_response = Patch::Order.retrieve_orders(
|
|
80
|
+
page: 1, metadata: { user: 'john' }
|
|
81
|
+
)
|
|
82
|
+
expect(retrieve_orders_response.success).to eq true
|
|
83
|
+
expect(retrieve_orders_response.data.count).to be >= 1
|
|
84
|
+
expect(retrieve_orders_response.data.map(&:metadata))
|
|
85
|
+
.to all(have_key(:user))
|
|
89
86
|
end
|
|
90
87
|
|
|
91
88
|
it 'supports place and cancel for orders created via an estimate' do
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
RSpec.describe 'Preferences Integration' do
|
|
2
|
-
before do
|
|
3
|
-
Patch.configure do |config|
|
|
4
|
-
config.access_token = ENV['SANDBOX_API_KEY']
|
|
5
|
-
end
|
|
6
|
-
end
|
|
7
|
-
|
|
8
2
|
it 'supports create, delete, retrieve and list' do
|
|
9
3
|
retrieve_projects_response = Patch::Project.retrieve_projects
|
|
10
4
|
expect(retrieve_projects_response.data.length).not_to be_zero
|
|
@@ -13,7 +7,7 @@ RSpec.describe 'Preferences Integration' do
|
|
|
13
7
|
begin
|
|
14
8
|
create_preference_response = Patch::Preference.create_preference(project_id: project_id)
|
|
15
9
|
preference_id = create_preference_response.data.id
|
|
16
|
-
rescue
|
|
10
|
+
rescue Patch::ApiError => e
|
|
17
11
|
preference_id = Patch::Preference.retrieve_preferences().data.first.id
|
|
18
12
|
end
|
|
19
13
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
RSpec.describe 'Projects Integration' do
|
|
2
|
-
Patch.configure do |config|
|
|
3
|
-
config.access_token = ENV['SANDBOX_API_KEY']
|
|
4
|
-
end
|
|
5
|
-
|
|
6
2
|
it 'supports retrieve and list' do
|
|
7
3
|
page_limit = 1
|
|
8
4
|
next_page = 1
|
|
@@ -43,20 +39,12 @@ RSpec.describe 'Projects Integration' do
|
|
|
43
39
|
end
|
|
44
40
|
|
|
45
41
|
describe 'returned fields' do
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it 'returns photos' do
|
|
51
|
-
expect(@project.photos).to be_an_instance_of(Array)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
it 'returns average_price_per_tonne_cents_usd' do
|
|
55
|
-
expect(@project.average_price_per_tonne_cents_usd).to be_an_instance_of(Integer)
|
|
56
|
-
end
|
|
42
|
+
it 'returns the expected fields' do
|
|
43
|
+
project = Patch::Project.retrieve_projects(page: 1).data.first
|
|
57
44
|
|
|
58
|
-
|
|
59
|
-
expect(
|
|
45
|
+
expect(project.photos).to be_an_instance_of(Array)
|
|
46
|
+
expect(project.average_price_per_tonne_cents_usd).to be_an_instance_of(Integer)
|
|
47
|
+
expect(project.remaining_mass_g).to be_an_instance_of(Integer)
|
|
60
48
|
end
|
|
61
49
|
end
|
|
62
50
|
end
|
|
@@ -30,7 +30,7 @@ describe 'CreateMassEstimateRequest' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { project_id: @instance.project_id, mass_g: @instance.mass_g } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:create_order]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of CreateMassEstimateRequest' do
|
|
@@ -30,7 +30,7 @@ describe 'ErrorResponse' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { success: @instance.success, error: @instance.error, data: @instance.data } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:data]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of ErrorResponse' do
|
|
@@ -30,7 +30,7 @@ describe 'EstimateListResponse' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { success: @instance.success, error: @instance.error, data: @instance.data, meta: @instance.meta } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:error]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of EstimateListResponse' do
|
|
@@ -30,7 +30,7 @@ describe 'EstimateResponse' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { success: @instance.success, error: @instance.error, data: @instance.data } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:error]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of EstimateResponse' do
|
|
@@ -30,7 +30,7 @@ describe 'Estimate' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { id: @instance.id, order: @instance.order.to_hash, production: @instance.production, type: @instance.type } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:order]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of Estimate' do
|
|
@@ -30,7 +30,7 @@ describe 'MetaIndexObject' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { next_page: @instance.next_page, prev_page: @instance.prev_page } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:next_page, :prev_page]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of MetaIndexObject' do
|
|
@@ -30,7 +30,7 @@ describe 'OrderListResponse' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { success: @instance.success, error: @instance.error, data: @instance.data, meta: @instance.meta } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:error]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of OrderListResponse' do
|
|
@@ -30,7 +30,7 @@ describe 'OrderResponse' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { success: @instance.success, error: @instance.error, data: @instance.data } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:error]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of OrderResponse' do
|
data/spec/models/order_spec.rb
CHANGED
|
@@ -41,7 +41,7 @@ describe 'Order' do
|
|
|
41
41
|
metadata: @instance.metadata
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
let(:nullable_properties) { Set.new([
|
|
44
|
+
let(:nullable_properties) { Set.new([:patch_fee_cents_usd, :price_cents_usd]) }
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
describe 'test an instance of Order' do
|
|
@@ -30,7 +30,7 @@ describe 'PreferenceListResponse' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { success: @instance.success, error: @instance.error, data: @instance.data, meta: @instance.meta } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:error]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of PreferenceListResponse' do
|
|
@@ -30,7 +30,7 @@ describe 'PreferenceResponse' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { success: @instance.success, error: @instance.error, data: @instance.data } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:error]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of PreferenceResponse' do
|
|
@@ -30,7 +30,7 @@ describe 'ProjectListResponse' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { success: @instance.success, error: @instance.error, data: @instance.data, meta: @instance.meta } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:error]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of ProjectListResponse' do
|
|
@@ -30,7 +30,7 @@ describe 'ProjectResponse' do
|
|
|
30
30
|
it_behaves_like "a generated class" do
|
|
31
31
|
let(:instance) { @instance }
|
|
32
32
|
let(:instance_hash) { { success: @instance.success, error: @instance.error, data: @instance.data } }
|
|
33
|
-
let(:nullable_properties) { Set.new([
|
|
33
|
+
let(:nullable_properties) { Set.new([:error]) }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
describe 'test an instance of ProjectResponse' do
|
data/spec/models/project_spec.rb
CHANGED
|
@@ -44,7 +44,7 @@ describe 'Project' do
|
|
|
44
44
|
standard: @instance.standard
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
let(:nullable_properties) { Set.new([
|
|
47
|
+
let(:nullable_properties) { Set.new([:photos, :standard, :sdgs]) }
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
describe 'test an instance of Project' do
|
data/spec/spec_helper.rb
CHANGED
|
@@ -6,17 +6,19 @@
|
|
|
6
6
|
The version of the OpenAPI document: v1
|
|
7
7
|
Contact: developers@usepatch.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
OpenAPI Generator version:
|
|
9
|
+
OpenAPI Generator version: 5.2.1
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
# load the gem
|
|
14
14
|
require 'patch_ruby'
|
|
15
|
+
# Start custom
|
|
15
16
|
require 'constants'
|
|
16
17
|
require 'factory_bot'
|
|
18
|
+
# End custom
|
|
17
19
|
|
|
18
20
|
# Require shared spec examples
|
|
19
|
-
Dir[
|
|
21
|
+
Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
|
|
20
22
|
|
|
21
23
|
# The following was generated by the `rspec --init` command. Conventionally, all
|
|
22
24
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
@@ -37,12 +39,6 @@ Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
|
|
|
37
39
|
#
|
|
38
40
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
39
41
|
RSpec.configure do |config|
|
|
40
|
-
# Use FactoryBot for test factories
|
|
41
|
-
config.include FactoryBot::Syntax::Methods
|
|
42
|
-
config.before(:suite) do
|
|
43
|
-
FactoryBot.find_definitions
|
|
44
|
-
end
|
|
45
|
-
|
|
46
42
|
# rspec-expectations config goes here. You can use an alternate
|
|
47
43
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
48
44
|
# assertions if you prefer.
|
|
@@ -66,46 +62,45 @@ RSpec.configure do |config|
|
|
|
66
62
|
mocks.verify_partial_doubles = true
|
|
67
63
|
end
|
|
68
64
|
|
|
69
|
-
# The settings below are suggested to provide a good initial experience
|
|
70
|
-
# with RSpec, but feel free to customize to your heart's content.
|
|
71
|
-
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
config.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
# - http://
|
|
87
|
-
# - http://
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
#
|
|
92
|
-
#
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
#
|
|
96
|
-
#
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
#
|
|
106
|
-
#
|
|
107
|
-
#
|
|
108
|
-
config.profile_examples = 10
|
|
65
|
+
# The settings below are suggested to provide a good initial experience
|
|
66
|
+
# with RSpec, but feel free to customize to your heart's content.
|
|
67
|
+
# # These two settings work together to allow you to limit a spec run
|
|
68
|
+
# # to individual examples or groups you care about by tagging them with
|
|
69
|
+
# # `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
|
70
|
+
# # get run.
|
|
71
|
+
# config.filter_run :focus
|
|
72
|
+
# config.run_all_when_everything_filtered = true
|
|
73
|
+
#
|
|
74
|
+
# # Allows RSpec to persist some state between runs in order to support
|
|
75
|
+
# # the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
76
|
+
# # you configure your source control system to ignore this file.
|
|
77
|
+
# config.example_status_persistence_file_path = "spec/examples.txt"
|
|
78
|
+
#
|
|
79
|
+
# # Limits the available syntax to the non-monkey patched syntax that is
|
|
80
|
+
# # recommended. For more details, see:
|
|
81
|
+
# # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
|
82
|
+
# # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
83
|
+
# # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
|
84
|
+
# config.disable_monkey_patching!
|
|
85
|
+
#
|
|
86
|
+
# # This setting enables warnings. It's recommended, but in some cases may
|
|
87
|
+
# # be too noisy due to issues in dependencies.
|
|
88
|
+
# config.warnings = true
|
|
89
|
+
#
|
|
90
|
+
# # Many RSpec users commonly either run the entire suite or an individual
|
|
91
|
+
# # file, and it's useful to allow more verbose output when running an
|
|
92
|
+
# # individual spec file.
|
|
93
|
+
# if config.files_to_run.one?
|
|
94
|
+
# # Use the documentation formatter for detailed output,
|
|
95
|
+
# # unless a formatter has already been configured
|
|
96
|
+
# # (e.g. via a command-line flag).
|
|
97
|
+
# config.default_formatter = 'doc'
|
|
98
|
+
# end
|
|
99
|
+
#
|
|
100
|
+
# # Print the 10 slowest examples and example groups at the
|
|
101
|
+
# # end of the spec run, to help surface which specs are running
|
|
102
|
+
# # particularly slow.
|
|
103
|
+
# config.profile_examples = 10
|
|
109
104
|
|
|
110
105
|
# Run specs in random order to surface order dependencies. If you find an
|
|
111
106
|
# order dependency and want to debug it, you can fix the order by providing
|
|
@@ -113,10 +108,31 @@ RSpec.configure do |config|
|
|
|
113
108
|
# --seed 1234
|
|
114
109
|
config.order = :random
|
|
115
110
|
|
|
116
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
|
117
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
118
|
-
# test failures related to randomization by passing the same `--seed` value
|
|
119
|
-
# as the one that triggered the failure.
|
|
120
|
-
Kernel.srand config.seed
|
|
121
|
-
|
|
111
|
+
# # Seed global randomization in this process using the `--seed` CLI option.
|
|
112
|
+
# # Setting this allows you to use `--seed` to deterministically reproduce
|
|
113
|
+
# # test failures related to randomization by passing the same `--seed` value
|
|
114
|
+
# # as the one that triggered the failure.
|
|
115
|
+
# Kernel.srand config.seed
|
|
116
|
+
|
|
117
|
+
######################
|
|
118
|
+
# Start custom section
|
|
119
|
+
######################
|
|
120
|
+
|
|
121
|
+
# Use FactoryBot for test factories
|
|
122
|
+
config.include FactoryBot::Syntax::Methods
|
|
123
|
+
config.before(:suite) do
|
|
124
|
+
FactoryBot.find_definitions
|
|
125
|
+
Patch.configure do |config|
|
|
126
|
+
if ENV.fetch('LOCAL_SDK_TEST', false)
|
|
127
|
+
config.access_token = ENV.fetch('LOCAL_PATCH_API_KEY')
|
|
128
|
+
config.scheme = 'http'
|
|
129
|
+
config.host = 'api.patch.test:3000'
|
|
130
|
+
else
|
|
131
|
+
config.access_token = ENV.fetch('SANDBOX_API_KEY')
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
######################
|
|
136
|
+
# End custom section
|
|
137
|
+
######################
|
|
122
138
|
end
|