File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 26
26
end
27
27
28
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
29
+ # biomass project
30
+ retrieve_project_response = Patch :: Project . retrieve_project ( "pro_test_c3a9feba769fc7a8806377266ca9ff6a" )
31
31
32
- create_order_response = Patch ::Order . create_order ( mass_g : 100_000 , project_id : project_id )
32
+ project_id = retrieve_project_response . data . id
33
+ average_price_per_tonne_cents_usd = retrieve_project_response . data . average_price_per_tonne_cents_usd
34
+
35
+ order_mass_g = 100_000
36
+ tonne_per_gram = 1_000_000
37
+
38
+ expected_price = ( average_price_per_tonne_cents_usd . to_f / tonne_per_gram ) * order_mass_g
39
+
40
+ create_order_response = Patch ::Order . create_order ( mass_g : order_mass_g , project_id : project_id )
33
41
34
42
expect ( create_order_response . success ) . to eq true
35
43
expect ( create_order_response . data . id ) . not_to be_nil
36
- expect ( create_order_response . data . mass_g ) . to eq ( 100_000 )
37
- expect ( create_order_response . data . price_cents_usd ) . to eq ( "10.0" )
38
- expect ( create_order_response . data . patch_fee_cents_usd ) . to eq ( "1.0" )
44
+ expect ( create_order_response . data . mass_g ) . to eq ( order_mass_g )
45
+ expect ( create_order_response . data . price_cents_usd . to_i ) . to eq ( expected_price )
46
+ expect ( create_order_response . data . patch_fee_cents_usd ) . not_to be_empty
39
47
end
40
48
41
49
it 'supports create with metadata' do
You can’t perform that action at this time.
0 commit comments