patch_ruby 1.9.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -2
- data/Gemfile.lock +20 -25
- data/lib/patch_ruby/api/estimates_api.rb +33 -25
- data/lib/patch_ruby/api/orders_api.rb +21 -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 +26 -21
- 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 +22 -13
- 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 +23 -15
- 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 +1 -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/preferences_spec.rb +1 -1
- 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 +68 -61
- metadata +38 -58
- data/lib/patch_ruby/.api_client.rb.un~ +0 -0
- data/lib/patch_ruby/.configuration.rb.un~ +0 -0
- data/lib/patch_ruby/.version.rb.un~ +0 -0
- data/lib/patch_ruby/api/.orders_api.rb.un~ +0 -0
- data/lib/patch_ruby/models/.create_ethereum_estimate_request.rb.un~ +0 -0
- data/spec/.spec_helper.rb.un~ +0 -0
- data/spec/integration/.estimates_spec.rb.un~ +0 -0
- data/spec/integration/.orders_spec.rb.un~ +0 -0
- data/spec/integration/.preferences_spec.rb.un~ +0 -0
- data/spec/integration/.projects_spec.rb.un~ +0 -0
@@ -6,11 +6,12 @@
|
|
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
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module Patch
|
16
17
|
class Standard
|
@@ -32,6 +33,11 @@ module Patch
|
|
32
33
|
}
|
33
34
|
end
|
34
35
|
|
36
|
+
# Returns all the JSON keys this model knows about
|
37
|
+
def self.acceptable_attributes
|
38
|
+
attribute_map.values
|
39
|
+
end
|
40
|
+
|
35
41
|
# Attribute type mapping.
|
36
42
|
def self.openapi_types
|
37
43
|
{
|
@@ -41,13 +47,13 @@ module Patch
|
|
41
47
|
}
|
42
48
|
end
|
43
49
|
|
44
|
-
#
|
50
|
+
# List of attributes with nullable: true
|
45
51
|
def self.openapi_nullable
|
46
|
-
|
47
|
-
|
48
|
-
nullable_properties
|
52
|
+
Set.new([
|
53
|
+
])
|
49
54
|
end
|
50
55
|
|
56
|
+
|
51
57
|
# Allows models with corresponding API classes to delegate API operations to those API classes
|
52
58
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
53
59
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
@@ -150,7 +156,9 @@ module Patch
|
|
150
156
|
def build_from_hash(attributes)
|
151
157
|
return nil unless attributes.is_a?(Hash)
|
152
158
|
self.class.openapi_types.each_pair do |key, type|
|
153
|
-
if
|
159
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
160
|
+
self.send("#{key}=", nil)
|
161
|
+
elsif type =~ /\AArray<(.*)>/i
|
154
162
|
# check to ensure the input is an array given that the attribute
|
155
163
|
# is documented as an array but the input is not
|
156
164
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -158,7 +166,7 @@ module Patch
|
|
158
166
|
end
|
159
167
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
160
168
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
161
|
-
end
|
169
|
+
end
|
162
170
|
end
|
163
171
|
|
164
172
|
self
|
@@ -170,8 +178,8 @@ module Patch
|
|
170
178
|
# @return [Object] Deserialized data
|
171
179
|
def _deserialize(type, value)
|
172
180
|
case type.to_sym
|
173
|
-
when :
|
174
|
-
|
181
|
+
when :Time
|
182
|
+
Time.parse(value)
|
175
183
|
when :Date
|
176
184
|
Date.parse(value)
|
177
185
|
when :String
|
@@ -201,7 +209,9 @@ module Patch
|
|
201
209
|
end
|
202
210
|
end
|
203
211
|
else # model
|
204
|
-
|
212
|
+
# models (e.g. Pet) or oneOf
|
213
|
+
klass = Patch.const_get(type)
|
214
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
205
215
|
end
|
206
216
|
end
|
207
217
|
|
@@ -227,7 +237,7 @@ module Patch
|
|
227
237
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
228
238
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
229
239
|
end
|
230
|
-
|
240
|
+
|
231
241
|
hash[param] = _to_hash(value)
|
232
242
|
end
|
233
243
|
hash
|
data/lib/patch_ruby/version.rb
CHANGED
@@ -6,10 +6,10 @@
|
|
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
|
module Patch
|
14
|
-
VERSION = '1.
|
14
|
+
VERSION = '1.10.0'
|
15
15
|
end
|
data/lib/patch_ruby.rb
CHANGED
data/patch_ruby.gemspec
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
The version of the OpenAPI document: v1
|
9
9
|
Contact: developers@usepatch.com
|
10
10
|
Generated by: https://openapi-generator.tech
|
11
|
-
OpenAPI Generator version:
|
11
|
+
OpenAPI Generator version: 5.2.1
|
12
12
|
|
13
13
|
=end
|
14
14
|
|
@@ -24,11 +24,10 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.homepage = "https://www.patch.io"
|
25
25
|
s.summary = "Ruby wrapper for the Patch API"
|
26
26
|
s.description = "Ruby wrapper for the Patch API"
|
27
|
-
s.license =
|
27
|
+
s.license = "MIT"
|
28
28
|
s.required_ruby_version = ">= 1.9"
|
29
29
|
|
30
30
|
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
31
|
-
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
|
32
31
|
|
33
32
|
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
34
33
|
|
@@ -36,4 +35,9 @@ Gem::Specification.new do |s|
|
|
36
35
|
s.test_files = `find spec/*`.split("\n")
|
37
36
|
s.executables = []
|
38
37
|
s.require_paths = ["lib"]
|
38
|
+
|
39
|
+
# Start custom
|
40
|
+
s.add_development_dependency 'factory_bot', '~> 6.2'
|
41
|
+
# End custom
|
42
|
+
|
39
43
|
end
|
data/spec/api_client_spec.rb
CHANGED
@@ -6,26 +6,47 @@
|
|
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
|
+
require 'spec_helper'
|
14
|
+
|
13
15
|
describe Patch::ApiClient do
|
14
16
|
context 'initialization' do
|
15
|
-
context '
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
context 'URL stuff' do
|
18
|
+
context 'host' do
|
19
|
+
it 'removes http from host' do
|
20
|
+
Patch.configure { |c| c.host = 'http://example.com' }
|
21
|
+
expect(Patch::Configuration.default.host).to eq('example.com')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'removes https from host' do
|
25
|
+
Patch.configure { |c| c.host = 'https://wookiee.com' }
|
26
|
+
expect(Patch::ApiClient.default.config.host).to eq('wookiee.com')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'removes trailing path from host' do
|
30
|
+
Patch.configure { |c| c.host = 'hobo.com/v4' }
|
31
|
+
expect(Patch::Configuration.default.host).to eq('hobo.com')
|
32
|
+
end
|
24
33
|
end
|
25
34
|
|
26
|
-
|
27
|
-
|
28
|
-
|
35
|
+
context 'base_path' do
|
36
|
+
it "prepends a slash to base_path" do
|
37
|
+
Patch.configure { |c| c.base_path = 'v4/dog' }
|
38
|
+
expect(Patch::Configuration.default.base_path).to eq('/v4/dog')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "doesn't prepend a slash if one is already there" do
|
42
|
+
Patch.configure { |c| c.base_path = '/v4/dog' }
|
43
|
+
expect(Patch::Configuration.default.base_path).to eq('/v4/dog')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "ends up as a blank string if nil" do
|
47
|
+
Patch.configure { |c| c.base_path = nil }
|
48
|
+
expect(Patch::Configuration.default.base_path).to eq('')
|
49
|
+
end
|
29
50
|
end
|
30
51
|
end
|
31
52
|
end
|
data/spec/configuration_spec.rb
CHANGED
@@ -7,7 +7,7 @@ RSpec.describe 'Preferences Integration' do
|
|
7
7
|
begin
|
8
8
|
create_preference_response = Patch::Preference.create_preference(project_id: project_id)
|
9
9
|
preference_id = create_preference_response.data.id
|
10
|
-
rescue
|
10
|
+
rescue Patch::ApiError => e
|
11
11
|
preference_id = Patch::Preference.retrieve_preferences().data.first.id
|
12
12
|
end
|
13
13
|
|
@@ -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,21 +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
|
-
Patch.configure do |config|
|
45
|
-
if ENV.fetch('LOCAL_SDK_TEST', false)
|
46
|
-
config.access_token = ENV.fetch('LOCAL_PATCH_API_KEY')
|
47
|
-
config.scheme = 'http'
|
48
|
-
config.host = 'api.patch.test:3000'
|
49
|
-
else
|
50
|
-
config.access_token = ENV.fetch('SANDBOX_API_KEY')
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
42
|
# rspec-expectations config goes here. You can use an alternate
|
56
43
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
57
44
|
# assertions if you prefer.
|
@@ -75,57 +62,77 @@ RSpec.configure do |config|
|
|
75
62
|
mocks.verify_partial_doubles = true
|
76
63
|
end
|
77
64
|
|
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
|
104
|
+
|
78
105
|
# Run specs in random order to surface order dependencies. If you find an
|
79
106
|
# order dependency and want to debug it, you can fix the order by providing
|
80
107
|
# the seed, which is printed after each run.
|
81
108
|
# --seed 1234
|
82
109
|
config.order = :random
|
83
110
|
|
84
|
-
#
|
85
|
-
#
|
86
|
-
|
87
|
-
#
|
88
|
-
#
|
89
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
90
|
-
# get run.
|
91
|
-
config.filter_run :focus
|
92
|
-
config.run_all_when_everything_filtered = true
|
93
|
-
|
94
|
-
# Allows RSpec to persist some state between runs in order to support
|
95
|
-
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
96
|
-
# you configure your source control system to ignore this file.
|
97
|
-
config.example_status_persistence_file_path = "spec/examples.txt"
|
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
|
98
116
|
|
99
|
-
|
100
|
-
#
|
101
|
-
|
102
|
-
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
103
|
-
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
104
|
-
config.disable_monkey_patching!
|
117
|
+
######################
|
118
|
+
# Start custom section
|
119
|
+
######################
|
105
120
|
|
106
|
-
#
|
107
|
-
|
108
|
-
config.
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
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
|
118
134
|
end
|
119
|
-
|
120
|
-
#
|
121
|
-
|
122
|
-
# particularly slow.
|
123
|
-
config.profile_examples = 10
|
124
|
-
|
125
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
126
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
127
|
-
# test failures related to randomization by passing the same `--seed` value
|
128
|
-
# as the one that triggered the failure.
|
129
|
-
Kernel.srand config.seed
|
130
|
-
=end
|
135
|
+
######################
|
136
|
+
# End custom section
|
137
|
+
######################
|
131
138
|
end
|