ship_compliant 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af2d76277ee247b655a0379f45fc8ef90c731c16
|
4
|
+
data.tar.gz: 722edef7e124c8f76100709a29323d276990b3e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79f05b87eed5ce74083be059f623bb91356d289a20d3a7d7c9de70311879ddf7662d6d811db09db11c039f7a61a4f74c71c40eb13e85302b5696d9b3b5a53ecb
|
7
|
+
data.tar.gz: ae8536cb971526eb361ead6981c84aa208dd99b48ac6362dc61c63e291801345f5d7ce3b8020fa8191f5890d8953b8087f594a30e852dceb69c63c46c3058217
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -52,11 +52,11 @@ TODO: Coming soon...
|
|
52
52
|
[core_service_path]: https://shipcompliant.desk.com/customer/portal/articles/1451976-api-coreservice-v1-2?b_id=2759
|
53
53
|
|
54
54
|
<!-- Status Badges -->
|
55
|
-
[Coverage Status]: https://coveralls.io/repos/ShipCompliant/ship_compliant-ruby/badge.
|
55
|
+
[Coverage Status]: https://coveralls.io/repos/ShipCompliant/ship_compliant-ruby/badge.svg?branch=master
|
56
56
|
[coveralls_status]: https://coveralls.io/r/ShipCompliant/ship_compliant-ruby?branch=master
|
57
57
|
|
58
|
-
[Build Status]: https://travis-ci.org/ShipCompliant/ship_compliant-ruby.
|
58
|
+
[Build Status]: https://travis-ci.org/ShipCompliant/ship_compliant-ruby.svg?branch=master
|
59
59
|
[travis_status]: https://travis-ci.org/ShipCompliant/ship_compliant-ruby
|
60
60
|
|
61
|
-
[Code Climate]: https://codeclimate.com/github/ShipCompliant/ship_compliant-ruby.
|
61
|
+
[Code Climate]: https://codeclimate.com/github/ShipCompliant/ship_compliant-ruby.svg
|
62
62
|
[code_gpa]: https://codeclimate.com/github/ShipCompliant/ship_compliant-ruby
|
@@ -54,7 +54,7 @@ When(/^I ignore existing brand on update$/) do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
Then(/^I should get an error for already defined brand$/) do
|
57
|
-
@brand_result.failure?.should
|
57
|
+
@brand_result.failure?.should be_truthy
|
58
58
|
@brand_result.errors.length.should == 1
|
59
59
|
error = @brand_result.errors.first
|
60
60
|
|
@@ -65,9 +65,9 @@ Then(/^I should get an error for already defined brand$/) do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
Then(/^the brand should have been updated$/) do
|
68
|
-
@brand_result.success?.should
|
68
|
+
@brand_result.success?.should be_truthy
|
69
69
|
end
|
70
70
|
|
71
71
|
Then(/^the brand should have been created$/) do
|
72
|
-
@brand_result.success?.should
|
72
|
+
@brand_result.success?.should be_truthy
|
73
73
|
end
|
@@ -10,6 +10,6 @@ When(/^I commit a sale with all shipments$/) do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
Then(/^I get a successful commit message$/) do
|
13
|
-
@order_commit_result.success?.should
|
13
|
+
@order_commit_result.success?.should be_truthy
|
14
14
|
@order_commit_result.committed_shipments.should == ['1']
|
15
15
|
end
|
@@ -90,8 +90,8 @@ When(/^I check compliance with an available product$/) do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
Then(/^I should receive the sales tax rates$/) do
|
93
|
-
@compliance_status.success?.should
|
94
|
-
@compliance_status.compliant?.should
|
93
|
+
@compliance_status.success?.should be_truthy
|
94
|
+
@compliance_status.compliant?.should be_truthy
|
95
95
|
|
96
96
|
# Tax Rates
|
97
97
|
@compliance_status.recommended_tax_due.should == 44.1
|
@@ -112,7 +112,7 @@ end
|
|
112
112
|
|
113
113
|
Then(/^I should receive the shipment compliance results$/) do
|
114
114
|
shipment_compliance = @compliance_status.compliance_rules_for_shipment('1')
|
115
|
-
shipment_compliance.compliant?.should
|
115
|
+
shipment_compliance.compliant?.should be_truthy
|
116
116
|
shipment_compliance.shipment_key.should == '1'
|
117
117
|
|
118
118
|
shipment_compliance.rules.length.should == 6
|
@@ -90,7 +90,7 @@ When(/^I check compliance with a missing product$/) do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
Then(/^I should receive a product key error$/) do
|
93
|
-
@compliance_status.failure?.should
|
93
|
+
@compliance_status.failure?.should be_truthy
|
94
94
|
@compliance_status.error_count.should == 1
|
95
95
|
error = @compliance_status.errors.first
|
96
96
|
|
@@ -86,7 +86,7 @@ When(/^I check compliance with a non\-compliant product$/) do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
Then(/^I should receive error messages$/) do
|
89
|
-
@compliance_status.compliant?.should
|
89
|
+
@compliance_status.compliant?.should be_falsey
|
90
90
|
shipment = @compliance_status.compliance_rules_for_shipment('1')
|
91
91
|
errors = shipment.rules.select { |r| !r.compliant? }
|
92
92
|
|
@@ -104,15 +104,15 @@ When(/^I ignore existing product on update$/) do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
Then(/^the product should have been created$/) do
|
107
|
-
@product_response.success?.should
|
107
|
+
@product_response.success?.should be_truthy
|
108
108
|
end
|
109
109
|
|
110
110
|
Then(/^I should get a message that the product was updated$/) do
|
111
|
-
@product_response.success?.should
|
111
|
+
@product_response.success?.should be_truthy
|
112
112
|
end
|
113
113
|
|
114
114
|
Then(/^I should get an error message for the missing brand$/) do
|
115
|
-
product_response.failure?.should
|
115
|
+
product_response.failure?.should be_truthy
|
116
116
|
product_response.errors_count.should == 1
|
117
117
|
|
118
118
|
error = product_response.errors[0]
|
@@ -124,7 +124,7 @@ Then(/^I should get an error message for the missing brand$/) do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
Then(/^I should get an error for already defined product$/) do
|
127
|
-
product_response.failure?.should
|
127
|
+
product_response.failure?.should be_truthy
|
128
128
|
product_response.errors_count.should == 1
|
129
129
|
|
130
130
|
error = product_response.errors[0]
|
@@ -12,7 +12,7 @@ end
|
|
12
12
|
|
13
13
|
Then(/^I should receive shipment compliance statuses$/) do
|
14
14
|
shipment_compliance = @order_result.compliance_rules_for_shipment('1')
|
15
|
-
shipment_compliance.compliant?.should
|
15
|
+
shipment_compliance.compliant?.should be_truthy
|
16
16
|
shipment_compliance.rules.should == []
|
17
17
|
end
|
18
18
|
|
@@ -69,7 +69,7 @@ Then(/^I should receive order channel details$/) do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
Then(/^I should receive an error that the order doesn't exist$/) do
|
72
|
-
@order_result.failure?.should
|
72
|
+
@order_result.failure?.should be_truthy
|
73
73
|
error = @order_result.errors.first
|
74
74
|
|
75
75
|
error.code.should == 200
|
@@ -11,12 +11,12 @@ When(/^I search with invalid paging cookie$/) do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
Then(/^I should have orders$/) do
|
14
|
-
@orders_result.success?.should
|
14
|
+
@orders_result.success?.should be_truthy
|
15
15
|
@orders_result.length.should == 100
|
16
16
|
end
|
17
17
|
|
18
18
|
Then(/^I should receive an invalid cookie error$/) do
|
19
|
-
@orders_result.failure?.should
|
19
|
+
@orders_result.failure?.should be_truthy
|
20
20
|
error = @orders_result.errors.first
|
21
21
|
|
22
22
|
error.message.should == 'PagingCookie was not found [00000000-0000-0000-0000-000000000000].'
|
@@ -14,7 +14,7 @@ When(/^I search with invalid criteria$/) do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
Then(/^I should receive a success status for search$/) do
|
17
|
-
@search_results.success?.should
|
17
|
+
@search_results.success?.should be_truthy
|
18
18
|
end
|
19
19
|
|
20
20
|
Then(/^I should have paging cookie information$/) do
|
@@ -23,7 +23,7 @@ Then(/^I should have paging cookie information$/) do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
Then(/^I should get an error status for search$/) do
|
26
|
-
@search_results.failure?.should
|
26
|
+
@search_results.failure?.should be_truthy
|
27
27
|
@search_results.error_count.should == 1
|
28
28
|
|
29
29
|
error = @search_results.errors.first
|
@@ -11,11 +11,11 @@ When(/^I void an already void order$/) do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
Then(/^I should get a successful response$/) do
|
14
|
-
@voided_order.success?.should
|
14
|
+
@voided_order.success?.should be_truthy
|
15
15
|
end
|
16
16
|
|
17
17
|
Then(/^I should get an error message$/) do
|
18
|
-
@voided_order.failure?.should
|
18
|
+
@voided_order.failure?.should be_truthy
|
19
19
|
@voided_order.errors_count.should == 1
|
20
20
|
|
21
21
|
error = @voided_order.errors[0]
|
data/features/support/env.rb
CHANGED
@@ -16,7 +16,7 @@ module ShipCompliant
|
|
16
16
|
# sales order without committing any of them.
|
17
17
|
#
|
18
18
|
# result = ShipCompliant::CommitSalesOrder.call({
|
19
|
-
#
|
19
|
+
# commit_option: 'AllShipments',
|
20
20
|
# payments: nil,
|
21
21
|
# sales_tax_collected: 0,
|
22
22
|
# sales_order_key: 'ORDER-KEY'
|
data/ship_compliant.gemspec
CHANGED
@@ -13,14 +13,14 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.homepage = "http://baylorrae.github.io/ship_compliant-ruby"
|
14
14
|
s.license = "MIT"
|
15
15
|
|
16
|
-
s.required_ruby_version = '>=
|
16
|
+
s.required_ruby_version = '>= 2.2.2'
|
17
17
|
|
18
18
|
s.files = `git ls-files -z`.split("\x0")
|
19
19
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
20
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
|
-
s.add_dependency "activesupport", "
|
23
|
+
s.add_dependency "activesupport", ">= 4.0.3"
|
24
24
|
s.add_dependency "savon", "~> 2.3"
|
25
25
|
|
26
26
|
s.add_development_dependency "bundler", "~> 1.5"
|
@@ -29,8 +29,9 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_development_dependency "pry", "~> 0.9"
|
30
30
|
|
31
31
|
# TESTING
|
32
|
-
s.add_development_dependency "rspec", "~>
|
32
|
+
s.add_development_dependency "rspec", "~> 3.3"
|
33
33
|
s.add_development_dependency "cucumber", "~> 1.3"
|
34
34
|
s.add_development_dependency "webmock", "~> 1.17"
|
35
35
|
s.add_development_dependency "vcr", "~> 2.9"
|
36
|
+
s.add_development_dependency "dotenv", "~> 2.0"
|
36
37
|
end
|
@@ -26,14 +26,14 @@ module ShipCompliant
|
|
26
26
|
|
27
27
|
context "product" do
|
28
28
|
it "queries the client with product an update mode" do
|
29
|
-
AddUpdateProduct.
|
29
|
+
allow(AddUpdateProduct).to receive(:add_update_product) { {} }
|
30
30
|
|
31
31
|
result = AddUpdateProduct.product({
|
32
32
|
bottle_size_ml: 123,
|
33
33
|
default_wholesale_case_price: 150
|
34
34
|
}, update_mode: 'DoWackaDo')
|
35
35
|
|
36
|
-
result.
|
36
|
+
expect(result).to be_kind_of(AddUpdateProductResult)
|
37
37
|
end
|
38
38
|
|
39
39
|
it "update mode defaults to ErrorOnExisting" do
|
@@ -3,17 +3,17 @@ require "spec_helper"
|
|
3
3
|
module ShipCompliant
|
4
4
|
describe SuggestedAddress do
|
5
5
|
|
6
|
-
it {
|
6
|
+
it { is_expected.to be_kind_of(Address) }
|
7
7
|
|
8
8
|
context "details" do
|
9
9
|
it "gets the details" do
|
10
|
-
subject.details.
|
10
|
+
expect(subject.details).to eq({ address_details: true })
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
context "parts" do
|
15
15
|
it "gets the parts" do
|
16
|
-
subject.parts.
|
16
|
+
expect(subject.parts).to eq({ address_parts: true })
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -5,96 +5,96 @@ module ShipCompliant
|
|
5
5
|
|
6
6
|
context "city" do
|
7
7
|
it "gets the city" do
|
8
|
-
subject.city.
|
8
|
+
expect(subject.city).to eq('A City')
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
context "county" do
|
13
13
|
it "gets the county" do
|
14
|
-
subject.county.
|
14
|
+
expect(subject.county).to eq('A County')
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context "state" do
|
19
19
|
it "gets the state" do
|
20
|
-
subject.state.
|
20
|
+
expect(subject.state).to eq('A State')
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
context "country" do
|
25
25
|
it "gets the country" do
|
26
|
-
subject.country.
|
26
|
+
expect(subject.country).to eq('A Country')
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
context "street1" do
|
31
31
|
it "gets street1" do
|
32
|
-
subject.street1.
|
32
|
+
expect(subject.street1).to eq('Street 1')
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context "street2" do
|
37
37
|
it "gets street2" do
|
38
|
-
subject.street2.
|
38
|
+
expect(subject.street2).to eq('Street 2')
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
context "zip1" do
|
43
43
|
it "gets zip1" do
|
44
|
-
subject.zip1.
|
44
|
+
expect(subject.zip1).to eq(12345)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
context "zip2" do
|
49
49
|
it "gets zip2" do
|
50
|
-
subject.zip2.
|
50
|
+
expect(subject.zip2).to eq(1234)
|
51
51
|
end
|
52
52
|
|
53
53
|
it "returns nil when empty" do
|
54
54
|
subject.address[:zip2] = nil
|
55
|
-
subject.zip2.
|
55
|
+
expect(subject.zip2).to be_nil
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
context "company" do
|
60
60
|
it "gets company" do
|
61
|
-
subject.company.
|
61
|
+
expect(subject.company).to eq('Dippin Dots')
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
context "date_of_birth" do
|
66
66
|
it "gets date_of_birth" do
|
67
|
-
subject.date_of_birth.
|
67
|
+
expect(subject.date_of_birth).to eq(Date.new(1967, 8, 12))
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
context "email" do
|
72
72
|
it "gets email" do
|
73
|
-
subject.email.
|
73
|
+
expect(subject.email).to eq('sogood@getdots.com')
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
context "fax" do
|
78
78
|
it "gets fax" do
|
79
|
-
subject.fax.
|
79
|
+
expect(subject.fax).to eq('(555) 123-8901')
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
context "phone" do
|
84
84
|
it "gets phone" do
|
85
|
-
subject.phone.
|
85
|
+
expect(subject.phone).to eq('(555) 123-4567')
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
89
|
context "first_name" do
|
90
90
|
it "gets first_name" do
|
91
|
-
subject.first_name.
|
91
|
+
expect(subject.first_name).to eq('Lt.')
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
95
|
context "last_name" do
|
96
96
|
it "gets last_name" do
|
97
|
-
subject.last_name.
|
97
|
+
expect(subject.last_name).to eq('Columbo')
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -28,27 +28,27 @@ module ShipCompliant
|
|
28
28
|
context "success?" do
|
29
29
|
it "returns true for successful response status" do
|
30
30
|
result = FauxResult.new(success_message)
|
31
|
-
result.success
|
31
|
+
expect(result.success?).to be_truthy
|
32
32
|
end
|
33
33
|
|
34
34
|
it "returns false for failed response status" do
|
35
35
|
result = FauxResult.new(failure_message)
|
36
|
-
result.success
|
36
|
+
expect(result.success?).to be_falsey
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
context "failure?" do
|
41
41
|
it "returns opposite of success?" do
|
42
42
|
result = FauxResult.new({})
|
43
|
-
result.
|
44
|
-
result.failure
|
43
|
+
allow(result).to receive(:success?) { false }
|
44
|
+
expect(result.failure?).to be_truthy
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
context "errors" do
|
49
49
|
it "returns an array of errors" do
|
50
50
|
result = FauxResult.new(failure_message)
|
51
|
-
result.errors.
|
51
|
+
expect(result.errors).to eq([
|
52
52
|
ErrorResult.new({
|
53
53
|
code: "404",
|
54
54
|
key: "OrderId",
|
@@ -56,7 +56,7 @@ module ShipCompliant
|
|
56
56
|
target: "SalesOrder",
|
57
57
|
type: "Validation"
|
58
58
|
})
|
59
|
-
]
|
59
|
+
])
|
60
60
|
end
|
61
61
|
|
62
62
|
it "doesn't break when errors is already an array" do
|
@@ -68,23 +68,23 @@ module ShipCompliant
|
|
68
68
|
]
|
69
69
|
})
|
70
70
|
|
71
|
-
result.errors.
|
71
|
+
expect(result.errors).to eq([
|
72
72
|
ErrorResult.new(code: '404'),
|
73
73
|
ErrorResult.new(code: '500')
|
74
|
-
]
|
74
|
+
])
|
75
75
|
end
|
76
76
|
|
77
77
|
it "returns an empty array for successful response" do
|
78
78
|
result = FauxResult.new(success_message)
|
79
|
-
result.errors.
|
79
|
+
expect(result.errors).to eq([])
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
context "errors_count" do
|
84
84
|
it "counts the number of errors" do
|
85
85
|
result = FauxResult.new({})
|
86
|
-
result.
|
87
|
-
result.errors_count.
|
86
|
+
allow(result).to receive(:errors) { [1, 2, 3 ] }
|
87
|
+
expect(result.errors_count).to eq(3)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -5,25 +5,25 @@ module ShipCompliant
|
|
5
5
|
|
6
6
|
context "order_channel" do
|
7
7
|
it "gets the order_channel" do
|
8
|
-
subject.order_channel.
|
8
|
+
expect(subject.order_channel).to eq('order-channel')
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
context "advertiser_key" do
|
13
13
|
it "gets the advertiser_key" do
|
14
|
-
subject.advertiser_key.
|
14
|
+
expect(subject.advertiser_key).to eq('advertiser-key')
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context "advertiser_name" do
|
19
19
|
it "gets the advertiser_name" do
|
20
|
-
subject.advertiser_name.
|
20
|
+
expect(subject.advertiser_name).to eq('advertiser-name')
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
context "meta" do
|
25
25
|
it "gets channel meta" do
|
26
|
-
subject.meta.
|
26
|
+
expect(subject.meta).to eq('channel-meta')
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -6,7 +6,7 @@ module ShipCompliant
|
|
6
6
|
|
7
7
|
context "compliant?" do
|
8
8
|
it "successed if the salesorder was compliant" do
|
9
|
-
subject.compliant
|
9
|
+
expect(subject.compliant?).to be_truthy
|
10
10
|
end
|
11
11
|
|
12
12
|
it "fails if the salesorder was not compliant" do
|
@@ -14,19 +14,19 @@ module ShipCompliant
|
|
14
14
|
sales_order: { is_compliant: false }
|
15
15
|
})
|
16
16
|
|
17
|
-
result.compliant
|
17
|
+
expect(result.compliant?).to be_falsey
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
context "recommended_tax_due" do
|
22
22
|
it "gets the tax due as a float" do
|
23
|
-
subject.recommended_tax_due.
|
23
|
+
expect(subject.recommended_tax_due).to eq(1372.34)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
context "shipment_sales_tax_rates" do
|
28
28
|
it "returns an array of sales tax rates" do
|
29
|
-
subject.shipment_sales_tax_rates.
|
29
|
+
expect(subject.shipment_sales_tax_rates).to eq([
|
30
30
|
{
|
31
31
|
:@shipment_key => 'ORDER-KEY',
|
32
32
|
freight_sales_tax_rate: {
|
@@ -42,54 +42,54 @@ module ShipCompliant
|
|
42
42
|
}
|
43
43
|
}
|
44
44
|
}
|
45
|
-
]
|
45
|
+
])
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
context "taxes_for_shipment" do
|
50
50
|
it "finds taxes from shipment_key" do
|
51
|
-
subject.taxes_for_shipment('ORDER-KEY').
|
51
|
+
expect(subject.taxes_for_shipment('ORDER-KEY')).to eq(ShipmentSalesTaxRate.new(
|
52
52
|
shipment_key = 'ORDER-KEY',
|
53
53
|
freight = FreightSalesTaxRate.new({ sales_tax_due: 100.5, sales_tax_rate: 10.34 }),
|
54
54
|
products = [
|
55
55
|
ProductSalesTaxRate.new({ brand_key: 'ABC', product_key: '123', sales_tax_due: 12.332, sales_tax_rate: 0.844 })
|
56
56
|
]
|
57
|
-
)
|
57
|
+
))
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
context "shipment_compliance_rules" do
|
62
62
|
it "returns compliance rules as an array" do
|
63
|
-
subject.shipment_compliance_rules.
|
63
|
+
expect(subject.shipment_compliance_rules).to eq([
|
64
64
|
{
|
65
65
|
is_compliant: true,
|
66
66
|
key: 'ORDER-KEY'
|
67
67
|
}
|
68
|
-
]
|
68
|
+
])
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
context "compliance_rules_for_shipment" do
|
73
73
|
it "finds compliance rules for shipment" do
|
74
|
-
subject.compliance_rules_for_shipment('ORDER-KEY').
|
74
|
+
expect(subject.compliance_rules_for_shipment('ORDER-KEY')).to eq(ShipmentCompliance.new({
|
75
75
|
is_compliant: true,
|
76
76
|
key: 'ORDER-KEY'
|
77
|
-
})
|
77
|
+
}))
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
context "address_validation_result" do
|
82
82
|
it "gets the address validation result" do
|
83
|
-
subject.address_validation_result.
|
83
|
+
expect(subject.address_validation_result).to eq('AddressValidated')
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
context "suggested_address" do
|
88
88
|
it "returns the suggested address" do
|
89
|
-
subject.suggested_address.
|
89
|
+
expect(subject.suggested_address).to eq(SuggestedAddress.new({
|
90
90
|
city: 'Bluebell',
|
91
91
|
state: 'Ice Cream'
|
92
|
-
})
|
92
|
+
}))
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|