ship_compliant 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -4
- data/CHANGELOG.md +7 -0
- data/README.md +3 -3
- data/features/step_definitions/brand_steps.rb +3 -3
- data/features/step_definitions/commit_sales_order/all_shipments.rb +1 -1
- data/features/step_definitions/compliance_check/available_product_steps.rb +3 -3
- data/features/step_definitions/compliance_check/missing_product_steps.rb +1 -1
- data/features/step_definitions/compliance_check/noncompliant_product.rb +1 -1
- data/features/step_definitions/product_steps.rb +4 -4
- data/features/step_definitions/sales_order_extended_steps.rb +2 -2
- data/features/step_definitions/search_more_orders_steps.rb +2 -2
- data/features/step_definitions/search_order_steps.rb +2 -2
- data/features/step_definitions/void_order_steps.rb +2 -2
- data/features/support/env.rb +3 -0
- data/lib/ship_compliant/commit_sales_order.rb +1 -1
- data/lib/ship_compliant/version.rb +1 -1
- data/ship_compliant.gemspec +4 -3
- data/spec/lib/ship_compliant/add_update_brand_spec.rb +1 -1
- data/spec/lib/ship_compliant/add_update_product_spec.rb +2 -2
- data/spec/lib/ship_compliant/address/suggested_address_spec.rb +3 -3
- data/spec/lib/ship_compliant/address_spec.rb +16 -16
- data/spec/lib/ship_compliant/base_result_spec.rb +11 -11
- data/spec/lib/ship_compliant/channel_details_spec.rb +4 -4
- data/spec/lib/ship_compliant/check_compliance_result_spec.rb +14 -14
- data/spec/lib/ship_compliant/check_compliance_spec.rb +1 -1
- data/spec/lib/ship_compliant/client_spec.rb +9 -9
- data/spec/lib/ship_compliant/commit_sales_order_result_spec.rb +3 -3
- data/spec/lib/ship_compliant/commit_sales_order_spec.rb +1 -1
- data/spec/lib/ship_compliant/compliance_rule_spec.rb +5 -5
- data/spec/lib/ship_compliant/configuration_spec.rb +8 -8
- data/spec/lib/ship_compliant/error_result_spec.rb +5 -5
- data/spec/lib/ship_compliant/freight_sales_tax_rate_spec.rb +1 -1
- data/spec/lib/ship_compliant/get_inventory_details_result_spec.rb +9 -9
- data/spec/lib/ship_compliant/get_inventory_details_spec.rb +1 -1
- data/spec/lib/ship_compliant/get_sales_order_extended_result_spec.rb +11 -11
- data/spec/lib/ship_compliant/get_sales_order_extended_spec.rb +2 -2
- data/spec/lib/ship_compliant/inventory_product_spec.rb +13 -13
- data/spec/lib/ship_compliant/order_search_spec.rb +3 -3
- data/spec/lib/ship_compliant/package_spec.rb +2 -2
- data/spec/lib/ship_compliant/product_attributes_spec.rb +4 -4
- data/spec/lib/ship_compliant/product_sales_tax_rate_spec.rb +3 -3
- data/spec/lib/ship_compliant/sales_tax_rate_spec.rb +2 -2
- data/spec/lib/ship_compliant/search_sales_order_summary_spec.rb +5 -5
- data/spec/lib/ship_compliant/search_sales_orders_result_spec.rb +12 -12
- data/spec/lib/ship_compliant/search_sales_orders_spec.rb +2 -2
- data/spec/lib/ship_compliant/shipment_compliance_spec.rb +5 -5
- data/spec/lib/ship_compliant/shipment_sales_tax_rate_spec.rb +1 -1
- data/spec/lib/ship_compliant/shipment_spec.rb +13 -13
- data/spec/lib/ship_compliant/void_sales_order_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -3
- metadata +21 -12
@@ -4,7 +4,7 @@ module ShipCompliant
|
|
4
4
|
describe Client do
|
5
5
|
|
6
6
|
it "inherits from Savon::Client" do
|
7
|
-
ShipCompliant.client.
|
7
|
+
expect(ShipCompliant.client).to be_kind_of(Savon::Client)
|
8
8
|
end
|
9
9
|
|
10
10
|
it "uses wsdl from configuration" do
|
@@ -12,12 +12,12 @@ module ShipCompliant
|
|
12
12
|
c.wsdl = 'http://example.com'
|
13
13
|
end
|
14
14
|
|
15
|
-
ShipCompliant.client.globals[:wsdl].
|
15
|
+
expect(ShipCompliant.client.globals[:wsdl]).to eq('http://example.com')
|
16
16
|
end
|
17
17
|
|
18
18
|
it "uses log value from configuration" do
|
19
19
|
# configuration is defined in spec_helper.rb
|
20
|
-
ShipCompliant.client.globals[:log].
|
20
|
+
expect(ShipCompliant.client.globals[:log]).to be_falsey
|
21
21
|
end
|
22
22
|
|
23
23
|
context "call" do
|
@@ -43,8 +43,8 @@ module ShipCompliant
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "the response's result directly" do
|
46
|
-
ShipCompliant.client.
|
47
|
-
|
46
|
+
allow(ShipCompliant.client).to receive(:savon_call) do
|
47
|
+
double(to_hash: {
|
48
48
|
a_method_response: {
|
49
49
|
a_method_result: {
|
50
50
|
response_status: 'Success'
|
@@ -54,18 +54,18 @@ module ShipCompliant
|
|
54
54
|
end
|
55
55
|
|
56
56
|
result = ShipCompliant.client.call(:a_method, {})
|
57
|
-
result.
|
57
|
+
expect(result).to eq({
|
58
58
|
response_status: 'Success'
|
59
|
-
}
|
59
|
+
})
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
context "wsdl=" do
|
64
64
|
it "changes the default wsdl" do
|
65
65
|
ShipCompliant.configuration = nil
|
66
|
-
ShipCompliant.client.globals[:wsdl].
|
66
|
+
expect(ShipCompliant.client.globals[:wsdl]).to eq('https://ws-dev.shipcompliant.com/services/1.2/coreservice.asmx?WSDL')
|
67
67
|
ShipCompliant.wsdl = 'http://ws.example.com?WSDL'
|
68
|
-
ShipCompliant.client.globals[:wsdl].
|
68
|
+
expect(ShipCompliant.client.globals[:wsdl]).to eq('http://ws.example.com?WSDL')
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -6,15 +6,15 @@ module ShipCompliant
|
|
6
6
|
|
7
7
|
context "shipments" do
|
8
8
|
it "returns the shipments as an array" do
|
9
|
-
subject.shipments.
|
9
|
+
expect(subject.shipments).to eq([
|
10
10
|
{ key: 'SHIPMENT-KEY', is_committed: true }
|
11
|
-
]
|
11
|
+
])
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
context "committed_shipments" do
|
16
16
|
it "returns the shipment keys for committed shipments" do
|
17
|
-
subject.committed_shipments.
|
17
|
+
expect(subject.committed_shipments).to eq(['SHIPMENT-KEY'])
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -5,31 +5,31 @@ module ShipCompliant
|
|
5
5
|
|
6
6
|
context "compliance_description" do
|
7
7
|
it "gets the description" do
|
8
|
-
subject.compliance_description.
|
8
|
+
expect(subject.compliance_description).to eq('Howdy Stranger')
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
context "rule_description" do
|
13
13
|
it "gets the rule" do
|
14
|
-
subject.rule_description.
|
14
|
+
expect(subject.rule_description).to eq('Must say hi to people you do not know.')
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context "compliant?" do
|
19
19
|
it "check this rule passed" do
|
20
|
-
subject.compliant
|
20
|
+
expect(subject.compliant?).to be_truthy
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
context "license_relationship" do
|
25
25
|
it "gets the relationship" do
|
26
|
-
subject.license_relationship.
|
26
|
+
expect(subject.license_relationship).to eq('StrangerToFriend')
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
context "rule_type" do
|
31
31
|
it "gets the rule type" do
|
32
|
-
subject.rule_type.
|
32
|
+
expect(subject.rule_type).to eq('BeCourteous')
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -13,33 +13,33 @@ module ShipCompliant
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "stores user credentials" do
|
16
|
-
ShipCompliant.configuration.partner_key.
|
17
|
-
ShipCompliant.configuration.username.
|
18
|
-
ShipCompliant.configuration.password.
|
16
|
+
expect(ShipCompliant.configuration.partner_key).to eq('abc-123')
|
17
|
+
expect(ShipCompliant.configuration.username).to eq('bob@example.com')
|
18
|
+
expect(ShipCompliant.configuration.password).to eq('secret')
|
19
19
|
end
|
20
20
|
|
21
21
|
it "creates authentication hash" do
|
22
|
-
ShipCompliant.configuration.credentials.
|
22
|
+
expect(ShipCompliant.configuration.credentials).to eq({
|
23
23
|
'PartnerKey' => 'abc-123',
|
24
24
|
'Username' => 'bob@example.com',
|
25
25
|
'Password' => 'secret'
|
26
|
-
}
|
26
|
+
})
|
27
27
|
end
|
28
28
|
|
29
29
|
it "defaults log to true" do
|
30
|
-
ShipCompliant.configuration.log.
|
30
|
+
expect(ShipCompliant.configuration.log).to be_truthy
|
31
31
|
end
|
32
32
|
|
33
33
|
context "wsdl" do
|
34
34
|
it "defaults to core services" do
|
35
|
-
ShipCompliant.configuration.wsdl.
|
35
|
+
expect(ShipCompliant.configuration.wsdl).to eq('https://ws-dev.shipcompliant.com/services/1.2/coreservice.asmx?WSDL')
|
36
36
|
end
|
37
37
|
|
38
38
|
it "can be changed" do
|
39
39
|
ShipCompliant.configure do |c|
|
40
40
|
c.wsdl = 'http://example.com'
|
41
41
|
end
|
42
|
-
ShipCompliant.configuration.wsdl.
|
42
|
+
expect(ShipCompliant.configuration.wsdl).to eq('http://example.com')
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -16,31 +16,31 @@ module ShipCompliant
|
|
16
16
|
|
17
17
|
context "code" do
|
18
18
|
it "returns the code as an integer" do
|
19
|
-
subject.code.
|
19
|
+
expect(subject.code).to eq(404)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
context "key" do
|
24
24
|
it "gets the key" do
|
25
|
-
subject.key.
|
25
|
+
expect(subject.key).to eq("OrderId")
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
context "message" do
|
30
30
|
it "gets the message" do
|
31
|
-
subject.message.
|
31
|
+
expect(subject.message).to eq("I'm smarter than the average bear, Boo Boo")
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
context "target" do
|
36
36
|
it "gets the target" do
|
37
|
-
subject.target.
|
37
|
+
expect(subject.target).to eq("SalesOrder")
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
context "type" do
|
42
42
|
it "gets the type" do
|
43
|
-
subject.type.
|
43
|
+
expect(subject.type).to eq("Validation")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -7,9 +7,9 @@ module ShipCompliant
|
|
7
7
|
|
8
8
|
context "locations" do
|
9
9
|
it "returns an array of locations" do
|
10
|
-
subject.locations.
|
10
|
+
expect(subject.locations).to eq([
|
11
11
|
inventory_location[:inventory_location]
|
12
|
-
]
|
12
|
+
])
|
13
13
|
end
|
14
14
|
|
15
15
|
it "handles a single location" do
|
@@ -17,31 +17,31 @@ module ShipCompliant
|
|
17
17
|
inventory_locations: inventory_location
|
18
18
|
})
|
19
19
|
|
20
|
-
result.locations.
|
20
|
+
expect(result.locations).to eq([
|
21
21
|
inventory_location[:inventory_location]
|
22
|
-
]
|
22
|
+
])
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
context "location" do
|
27
27
|
it "finds a location" do
|
28
|
-
subject.location('WineShipping').
|
28
|
+
expect(subject.location('WineShipping')).to eq(inventory_location[:inventory_location])
|
29
29
|
end
|
30
30
|
|
31
31
|
it "returns an empty hash when invalid" do
|
32
|
-
subject.location('toys-r-us').
|
32
|
+
expect(subject.location('toys-r-us')).to eq({})
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context "products_for_location" do
|
37
37
|
it "returns an array of products" do
|
38
|
-
subject.products_for_location('WineShipping').
|
38
|
+
expect(subject.products_for_location('WineShipping')).to eq([
|
39
39
|
InventoryProduct.new(product_key: 'PRODUCT-KEY', inventory_levels: inventory_level)
|
40
|
-
]
|
40
|
+
])
|
41
41
|
end
|
42
42
|
|
43
43
|
it "returns empty array for invalid location" do
|
44
|
-
subject.products_for_location('toys-r-us').
|
44
|
+
expect(subject.products_for_location('toys-r-us')).to eq([])
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -6,54 +6,54 @@ module ShipCompliant
|
|
6
6
|
|
7
7
|
context "shipment_compliance_rules" do
|
8
8
|
it "returns compliance rules as an array" do
|
9
|
-
subject.shipment_compliance_rules.
|
9
|
+
expect(subject.shipment_compliance_rules).to eq([
|
10
10
|
{
|
11
11
|
is_compliant: true,
|
12
12
|
key: 'SHIPMENT-KEY',
|
13
13
|
}
|
14
|
-
]
|
14
|
+
])
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context "compliance_rules_for_shipment" do
|
19
19
|
it "finds compliance rules for shipment" do
|
20
|
-
subject.compliance_rules_for_shipment('SHIPMENT-KEY').
|
20
|
+
expect(subject.compliance_rules_for_shipment('SHIPMENT-KEY')).to eq(ShipmentCompliance.new({
|
21
21
|
is_compliant: true,
|
22
22
|
key: 'SHIPMENT-KEY'
|
23
|
-
})
|
23
|
+
}))
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
context "bill_to" do
|
28
28
|
it "returns an Address" do
|
29
|
-
subject.bill_to.
|
29
|
+
expect(subject.bill_to).to eq(Address.new({
|
30
30
|
city: 'Jellystone Park',
|
31
31
|
state: 'WY'
|
32
|
-
})
|
32
|
+
}))
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context "shipments" do
|
37
37
|
it "returns an array of shipments" do
|
38
|
-
subject.shipments.
|
38
|
+
expect(subject.shipments).to eq([{
|
39
39
|
shipment_key: 'SHIPMENT-KEY',
|
40
40
|
shipment_items: []
|
41
|
-
}]
|
41
|
+
}])
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
context "find_shipment" do
|
46
46
|
it "returns the shipment" do
|
47
|
-
subject.find_shipment('SHIPMENT-KEY').
|
47
|
+
expect(subject.find_shipment('SHIPMENT-KEY')).to eq(Shipment.new({
|
48
48
|
shipment_key: 'SHIPMENT-KEY',
|
49
49
|
shipment_items: []
|
50
|
-
})
|
50
|
+
}))
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
context "channel_details" do
|
55
55
|
it "returns the details" do
|
56
|
-
subject.channel_details.
|
56
|
+
expect(subject.channel_details).to eq(ChannelDetails.new(some_details: 'online sales'))
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -30,9 +30,9 @@ module ShipCompliant
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "returns GetSalesOrderExtendedResult" do
|
33
|
-
ShipCompliant.client.
|
33
|
+
allow(ShipCompliant.client).to receive(:call) { {} }
|
34
34
|
result = GetSalesOrderExtended.by_order_key('order-id')
|
35
|
-
result.
|
35
|
+
expect(result).to be_kind_of(GetSalesOrderExtendedResult)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -5,77 +5,77 @@ module ShipCompliant
|
|
5
5
|
|
6
6
|
context "default_case" do
|
7
7
|
it "returns the default case" do
|
8
|
-
subject.default_case.
|
8
|
+
expect(subject.default_case).to eq('DEFAULT-CASE')
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
context "description" do
|
13
13
|
it "returns the description" do
|
14
|
-
subject.description.
|
14
|
+
expect(subject.description).to eq('PRODUCT-DESCRIPTION')
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context "fulfillment_sku" do
|
19
19
|
it "returns the fulfillment_sku" do
|
20
|
-
subject.fulfillment_sku.
|
20
|
+
expect(subject.fulfillment_sku).to eq('FULFILLMENT-SKU')
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
context "percent_alcohol" do
|
25
25
|
it "returns the percent_alcohol" do
|
26
|
-
subject.percent_alcohol.
|
26
|
+
expect(subject.percent_alcohol).to eq(98.43)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
context "product_key" do
|
31
31
|
it "returns the product_key" do
|
32
|
-
subject.product_key.
|
32
|
+
expect(subject.product_key).to eq('PRODUCT-KEY')
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context "product_type" do
|
37
37
|
it "returns the product_key" do
|
38
|
-
subject.product_type.
|
38
|
+
expect(subject.product_type).to eq('PRODUCT-TYPE')
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
context "unit_price" do
|
43
43
|
it "returns the unit_price" do
|
44
|
-
subject.unit_price.
|
44
|
+
expect(subject.unit_price).to eq(873.21)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
context "vintage" do
|
49
49
|
it "returns the vintage" do
|
50
|
-
subject.vintage.
|
50
|
+
expect(subject.vintage).to eq(1922)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
context "volume_amount" do
|
55
55
|
it "returns the volume_amount" do
|
56
|
-
subject.volume_amount.
|
56
|
+
expect(subject.volume_amount).to eq(944.0)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
context "volume_ml" do
|
61
61
|
it "returns the volume_ml" do
|
62
|
-
subject.volume_ml.
|
62
|
+
expect(subject.volume_ml).to eq(944.0)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
context "volume_unit" do
|
67
67
|
it "returns the volume_unit" do
|
68
|
-
subject.volume_unit.
|
68
|
+
expect(subject.volume_unit).to eq('Milliliter')
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
context "inventory_levels" do
|
73
73
|
it "returns a hash of inventory levels" do
|
74
|
-
subject.inventory_levels.
|
74
|
+
expect(subject.inventory_levels).to eq({
|
75
75
|
available: 100,
|
76
76
|
on_hand: 20,
|
77
77
|
some_amazing_type: 1000
|
78
|
-
}
|
78
|
+
})
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -6,14 +6,14 @@ module ShipCompliant
|
|
6
6
|
context "to_h" do
|
7
7
|
it "converts keys to pascal case" do
|
8
8
|
order = OrderSearch.new(sales_order_key_min: 10)
|
9
|
-
order.to_h.
|
9
|
+
expect(order.to_h).to eq({
|
10
10
|
"SalesOrderKeyMin" => 10
|
11
|
-
}
|
11
|
+
})
|
12
12
|
end
|
13
13
|
|
14
14
|
it "ignores invalid keys" do
|
15
15
|
order = OrderSearch.new(xyz: 5)
|
16
|
-
order.to_h.
|
16
|
+
expect(order.to_h).to eq({})
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -5,13 +5,13 @@ module ShipCompliant
|
|
5
5
|
|
6
6
|
context "tracking_number" do
|
7
7
|
it "gets the tracking_number" do
|
8
|
-
subject.tracking_number.
|
8
|
+
expect(subject.tracking_number).to eq('tracking-number')
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
context "tracking_status" do
|
13
13
|
it "gets the tracking_status" do
|
14
|
-
subject.tracking_status.
|
14
|
+
expect(subject.tracking_status).to eq('Lost in Transit')
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -6,9 +6,9 @@ module ShipCompliant
|
|
6
6
|
context "to_h" do
|
7
7
|
it "converts keys to pascal case" do
|
8
8
|
product = ProductAttributes.new(unit_price: 10)
|
9
|
-
product.to_h.
|
9
|
+
expect(product.to_h).to eq({
|
10
10
|
"UnitPrice" => 10
|
11
|
-
}
|
11
|
+
})
|
12
12
|
end
|
13
13
|
|
14
14
|
it "handles special cases" do
|
@@ -21,14 +21,14 @@ module ShipCompliant
|
|
21
21
|
upc: 'value'
|
22
22
|
)
|
23
23
|
|
24
|
-
product.to_h.
|
24
|
+
expect(product.to_h).to eq({
|
25
25
|
'BottleSizeML' => 'value',
|
26
26
|
'GTIN' => 'value',
|
27
27
|
'NABCA' => 'value',
|
28
28
|
'SCC' => 'value',
|
29
29
|
'UNIMERC' => 'value',
|
30
30
|
'UPC' => 'value'
|
31
|
-
}
|
31
|
+
})
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -3,18 +3,18 @@ require "spec_helper"
|
|
3
3
|
module ShipCompliant
|
4
4
|
describe ProductSalesTaxRate do
|
5
5
|
|
6
|
-
it {
|
6
|
+
it { is_expected.to be_kind_of(SalesTaxRate) }
|
7
7
|
subject { ProductSalesTaxRate.new(brand_key: 'brand-key', product_key: 'the-product') }
|
8
8
|
|
9
9
|
context "product_key" do
|
10
10
|
it "returns the product key" do
|
11
|
-
subject.product_key.
|
11
|
+
expect(subject.product_key).to eq('the-product')
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
context "brand_key" do
|
16
16
|
it "returns the brand key" do
|
17
|
-
subject.brand_key.
|
17
|
+
expect(subject.brand_key).to eq('brand-key')
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -6,14 +6,14 @@ module ShipCompliant
|
|
6
6
|
context "sales_tax_due" do
|
7
7
|
it "returns sales_tax_due" do
|
8
8
|
tax_rate = SalesTaxRate.new(sales_tax_due: '34.43')
|
9
|
-
tax_rate.sales_tax_due.
|
9
|
+
expect(tax_rate.sales_tax_due).to eq(34.43)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
context "sales_tax_rate" do
|
14
14
|
it "return sales_tax_rate" do
|
15
15
|
tax_rate = SalesTaxRate.new(sales_tax_rate: '2.34')
|
16
|
-
tax_rate.sales_tax_rate.
|
16
|
+
expect(tax_rate.sales_tax_rate).to eq(2.34)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -26,20 +26,20 @@ module ShipCompliant
|
|
26
26
|
|
27
27
|
context "purchase_date" do
|
28
28
|
it "returns a DateTime from the purchase date" do
|
29
|
-
summary.purchase_date.
|
29
|
+
expect(summary.purchase_date).to eq(DateTime.new(2014, 1, 1))
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
context "order_key" do
|
34
34
|
it "returns the order_key" do
|
35
|
-
summary.order_key.
|
36
|
-
summary.sales_order_key.
|
35
|
+
expect(summary.order_key).to eq('ORD-1')
|
36
|
+
expect(summary.sales_order_key).to eq('ORD-1')
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
context "shipment_summary" do
|
41
41
|
it "the parsed hash" do
|
42
|
-
summary.shipment_summary.
|
42
|
+
expect(summary.shipment_summary).to eq({
|
43
43
|
compliance: 'Perfect Score',
|
44
44
|
requested_ship_date: '2014-01-03T14:30:00',
|
45
45
|
ship_date: '2014-01-03T12:23:00',
|
@@ -49,7 +49,7 @@ module ShipCompliant
|
|
49
49
|
last_name: 'Smith',
|
50
50
|
zip1: 80234
|
51
51
|
}
|
52
|
-
}
|
52
|
+
})
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|