File tree 3 files changed +37
-3
lines changed
3 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ Layout/SpaceInsideParens:
113
113
# EnforcedStyle: single_quotes
114
114
115
115
# Detect hard tabs, no hard tabs.
116
- Layout/Tab :
116
+ Layout/IndentationStyle :
117
117
Enabled : true
118
118
119
119
# Blank lines should not have any spaces.
Original file line number Diff line number Diff line change 1
1
RSpec . describe 'Estimates Integration' do
2
- it 'supports create, retrieve and list' do
3
- # Configure the Patch gem
2
+ before do
4
3
Patch . configure do |config |
5
4
config . access_token = ENV [ 'PATCH_RUBY_API_KEY' ]
6
5
end
6
+ end
7
7
8
+ it 'supports create, retrieve and list' do
8
9
create_estimate_response = Patch ::Estimate . create_mass_estimate ( mass_g : 100 )
9
10
estimate_id = create_estimate_response . data . id
10
11
23
24
24
25
expect ( estimates . length ) . not_to be_zero
25
26
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
26
38
end
Original file line number Diff line number Diff line change 25
25
expect ( orders . length ) . not_to be_zero
26
26
end
27
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
+
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
+
28
50
it 'supports place and cancel for orders created via an estimate' do
29
51
create_estimate_to_place_response = Patch ::Estimate . create_mass_estimate ( mass_g : 100 )
30
52
order_to_place_id = create_estimate_to_place_response . data . order . id
You can’t perform that action at this time.
0 commit comments