spec/integration/estimates_spec.rb in patch_ruby-1.24.1 vs spec/integration/estimates_spec.rb in patch_ruby-1.24.2

- old
+ new

@@ -88,11 +88,10 @@ expect(create_estimate_response.data.type).to eq 'shipping' expect(create_estimate_response.data.mass_g).to be >= 10_000 end - it 'supports creating bitcoin estimates with partial information' do bitcoin_estimate = Patch::Estimate.create_bitcoin_estimate() expect(bitcoin_estimate.data.type).to eq 'bitcoin' expect(bitcoin_estimate.data.mass_g).to be >= 2_000 @@ -170,21 +169,35 @@ expect(create_estimate_response.data.type).to eq 'hotel' expect(create_estimate_response.data.mass_g).to be >= 100_000 expect(create_estimate_response.data.id).not_to be_nil end + it 'supports creating ecommerce estimates' do + distance_m = 100_000_000 + package_mass_g = 10_000 + create_estimate_response = Patch::Estimate.create_ecommerce_estimate( + distance_m: distance_m, + package_mass_g: package_mass_g, + transportation_method: 'rail', + create_order: false + ) + + expect(create_estimate_response.data.type).to eq 'ecommerce' + expect(create_estimate_response.data.mass_g).to be >= 10_000 + end + context "when creating an air shipping estimate" do it "supports creating an estimate using airports" do air_shipping_estimate = Patch::Estimate.create_air_shipping_estimate( aircraft_type: "cargo", create_order: false, destination_airport: "JFK", freight_mass_g: 31_300, origin_airport: "SFO" ) expect(air_shipping_estimate.data.type).to eq('shipping_air') - expect(air_shipping_estimate.data.mass_g).to be >= 20_000 + expect(air_shipping_estimate.data.mass_g).to be > 0 end it "supports creating an estimate with an order" do air_shipping_estimate = Patch::Estimate.create_air_shipping_estimate( aircraft_type: "cargo", @@ -192,12 +205,12 @@ destination_airport: "JFK", freight_mass_g: 19_140, origin_airport: "SFO" ) expect(air_shipping_estimate.data.type).to eq('shipping_air') - expect(air_shipping_estimate.data.mass_g).to be >= 20_000 - expect(air_shipping_estimate.data.order.amount).to be >= 10_000 + expect(air_shipping_estimate.data.mass_g).to be > 0 + expect(air_shipping_estimate.data.order.amount).to be > 0 end end context "when creating a rail shipping estimate" do it "supports creating an estimate using locodes" do @@ -208,11 +221,11 @@ freight_mass_g: 419_060, fuel_type: "diesel", origin_locode: "USSD2" ) expect(rail_shipping_estimate.data.type).to eq('shipping_rail') - expect(rail_shipping_estimate.data.mass_g).to be >= 15_000 + expect(rail_shipping_estimate.data.mass_g).to be > 0 end it "supports creating an estimate using postal codes" do rail_shipping_estimate = Patch::Estimate.create_rail_shipping_estimate( create_order: false, @@ -223,23 +236,23 @@ fuel_type: "diesel", origin_country_code: "US", origin_postal_code: "90210" ) expect(rail_shipping_estimate.data.type).to eq('shipping_rail') - expect(rail_shipping_estimate.data.mass_g).to be >= 4_000 + expect(rail_shipping_estimate.data.mass_g).to be > 0 end it "supports creating an estimate with an order" do rail_shipping_estimate = Patch::Estimate.create_rail_shipping_estimate( create_order: true, destination_locode: "USSEA", freight_mass_g: 359_000, origin_locode: "USSD2" ) expect(rail_shipping_estimate.data.type).to eq('shipping_rail') - expect(rail_shipping_estimate.data.mass_g).to be >= 15_000 - expect(rail_shipping_estimate.data.order.amount).to be >= 10_000 + expect(rail_shipping_estimate.data.mass_g).to be > 0 + expect(rail_shipping_estimate.data.order.amount).to be > 0 end end context "when creating a road shipping estimate" do it "supports creating an estimate using locodes" do @@ -250,11 +263,11 @@ emissions_scope: "wtw", freight_mass_g: 124_870, origin_locode: "USSD2" ) expect(road_shipping_estimate.data.type).to eq('shipping_road') - expect(road_shipping_estimate.data.mass_g).to be >= 15_000 + expect(road_shipping_estimate.data.mass_g).to be > 0 end it "supports creating an estimate using postal codes" do road_shipping_estimate = Patch::Estimate.create_road_shipping_estimate( create_order: false, @@ -264,23 +277,23 @@ freight_mass_g: 226_000, origin_country_code: "US", origin_postal_code: "90210" ) expect(road_shipping_estimate.data.type).to eq('shipping_road') - expect(road_shipping_estimate.data.mass_g).to be >= 4_000 + expect(road_shipping_estimate.data.mass_g).to be > 0 end it "supports creating an estimate with an order" do road_shipping_estimate = Patch::Estimate.create_road_shipping_estimate( create_order: true, destination_locode: "USSEA", freight_mass_g: 359_000, origin_locode: "USSD2" ) expect(road_shipping_estimate.data.type).to eq('shipping_road') - expect(road_shipping_estimate.data.mass_g).to be >= 15_000 - expect(road_shipping_estimate.data.order.amount).to be >= 10_000 + expect(road_shipping_estimate.data.mass_g).to be > 0 + expect(road_shipping_estimate.data.order.amount).to be > 0 end end context "when creating a sea shipping estimate" do it "supports creating an estimate using locodes" do @@ -291,11 +304,11 @@ emissions_scope: "wtw", freight_mass_g: 124_870, origin_locode: "FRMRS" ) expect(sea_shipping_estimate.data.type).to eq('shipping_sea') - expect(sea_shipping_estimate.data.mass_g).to be >= 10_000 + expect(sea_shipping_estimate.data.mass_g).to be > 0 end it "supports creating an estimate using postal codes" do sea_shipping_estimate = Patch::Estimate.create_sea_shipping_estimate( create_order: false, @@ -305,21 +318,21 @@ freight_mass_g: 226_000, origin_country_code: "US", origin_postal_code: "90210" ) expect(sea_shipping_estimate.data.type).to eq('shipping_sea') - expect(sea_shipping_estimate.data.mass_g).to be >= 4_000 + expect(sea_shipping_estimate.data.mass_g).to be > 0 end it "supports creating an estimate with an order" do sea_shipping_estimate = Patch::Estimate.create_sea_shipping_estimate( create_order: true, destination_locode: "USSEA", freight_mass_g: 359_000, origin_locode: "USSD2" ) expect(sea_shipping_estimate.data.type).to eq('shipping_sea') - expect(sea_shipping_estimate.data.mass_g).to be >= 15_000 - expect(sea_shipping_estimate.data.order.amount).to be >= 10_000 + expect(sea_shipping_estimate.data.mass_g).to be > 0 + expect(sea_shipping_estimate.data.order.amount).to be > 0 end end end