Skip to content

Commit f5ed8d8

Browse files
committed
specs
1 parent 68ce248 commit f5ed8d8

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Layout/SpaceInsideParens:
113113
# EnforcedStyle: single_quotes
114114

115115
# Detect hard tabs, no hard tabs.
116-
Layout/Tab:
116+
Layout/IndentationStyle:
117117
Enabled: true
118118

119119
# Blank lines should not have any spaces.

spec/integration/estimates_spec.rb

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
RSpec.describe 'Estimates Integration' do
2-
it 'supports create, retrieve and list' do
3-
# Configure the Patch gem
2+
before do
43
Patch.configure do |config|
54
config.access_token = ENV['PATCH_RUBY_API_KEY']
65
end
6+
end
77

8+
it 'supports create, retrieve and list' do
89
create_estimate_response = Patch::Estimate.create_mass_estimate(mass_g: 100)
910
estimate_id = create_estimate_response.data.id
1011

@@ -23,4 +24,15 @@
2324

2425
expect(estimates.length).not_to be_zero
2526
end
27+
28+
it 'supports create with a project-id' do
29+
retrieve_projects_response = Patch::Project.retrieve_projects(page: 1)
30+
project_id = retrieve_projects_response.data.first.id
31+
create_estimate_response = Patch::Estimate.create_mass_estimate(mass_g: 100, project_id: project_id)
32+
estimate_id = create_estimate_response.data.id
33+
34+
expect(create_estimate_response.success).to eq true
35+
expect(create_estimate_response.data.order.id).not_to be_nil
36+
expect(create_estimate_response.data.order.mass_g).to eq(100)
37+
end
2638
end

spec/integration/orders_spec.rb

+22
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,28 @@
2525
expect(orders.length).not_to be_zero
2626
end
2727

28+
it 'supports create with a project-id' do
29+
retrieve_projects_response = Patch::Project.retrieve_projects(page: 1)
30+
project_id = retrieve_projects_response.data.first.id
31+
32+
create_order_response = Patch::Order.create_order(mass_g: 100, project_id: project_id)
33+
34+
expect(create_order_response.success).to eq true
35+
expect(create_order_response.data.id).not_to be_nil
36+
expect(create_order_response.data.mass_g).to eq(100)
37+
end
38+
39+
it 'supports create with metadata' do
40+
metadata = { user: 'john doe' }
41+
42+
create_order_response = Patch::Order.create_order(mass_g: 100, metadata: metadata)
43+
44+
expect(create_order_response.success).to eq true
45+
expect(create_order_response.data.id).not_to be_nil
46+
expect(create_order_response.data.mass_g).to eq(100)
47+
expect(create_order_response.data.metadata).to eq(metadata)
48+
end
49+
2850
it 'supports place and cancel for orders created via an estimate' do
2951
create_estimate_to_place_response = Patch::Estimate.create_mass_estimate(mass_g: 100)
3052
order_to_place_id = create_estimate_to_place_response.data.order.id

0 commit comments

Comments
 (0)