cxml-ruby 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +23 -0
  3. data/.gitignore +14 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +175 -0
  6. data/Gemfile +2 -0
  7. data/LICENSE +18 -0
  8. data/README.md +94 -0
  9. data/Rakefile +6 -0
  10. data/cxml-ruby.gemspec +27 -0
  11. data/lib/cxml/accounting.rb +27 -0
  12. data/lib/cxml/additional_cost.rb +10 -0
  13. data/lib/cxml/additional_deduction.rb +12 -0
  14. data/lib/cxml/address.rb +16 -0
  15. data/lib/cxml/bill_to.rb +10 -0
  16. data/lib/cxml/browser_form_post.rb +13 -0
  17. data/lib/cxml/charge.rb +9 -0
  18. data/lib/cxml/classification.rb +9 -0
  19. data/lib/cxml/confirmation_header.rb +16 -0
  20. data/lib/cxml/confirmation_item.rb +14 -0
  21. data/lib/cxml/confirmation_request.rb +25 -0
  22. data/lib/cxml/confirmation_status.rb +32 -0
  23. data/lib/cxml/contact.rb +16 -0
  24. data/lib/cxml/country.rb +9 -0
  25. data/lib/cxml/credential.rb +49 -0
  26. data/lib/cxml/credential_mac.rb +26 -0
  27. data/lib/cxml/deducted_price.rb +9 -0
  28. data/lib/cxml/deduction_amount.rb +9 -0
  29. data/lib/cxml/description.rb +9 -0
  30. data/lib/cxml/discount.rb +10 -0
  31. data/lib/cxml/discount_percent.rb +9 -0
  32. data/lib/cxml/distribution.rb +11 -0
  33. data/lib/cxml/document.rb +71 -0
  34. data/lib/cxml/document_node.rb +126 -0
  35. data/lib/cxml/document_reference.rb +9 -0
  36. data/lib/cxml/due_amount.rb +9 -0
  37. data/lib/cxml/email.rb +10 -0
  38. data/lib/cxml/errors.rb +7 -0
  39. data/lib/cxml/extrinsic.rb +10 -0
  40. data/lib/cxml/from.rb +9 -0
  41. data/lib/cxml/gross_amount.rb +9 -0
  42. data/lib/cxml/header.rb +29 -0
  43. data/lib/cxml/id_reference.rb +13 -0
  44. data/lib/cxml/invoice_detail_discount.rb +13 -0
  45. data/lib/cxml/invoice_detail_header_indicator.rb +11 -0
  46. data/lib/cxml/invoice_detail_header_order.rb +24 -0
  47. data/lib/cxml/invoice_detail_item.rb +55 -0
  48. data/lib/cxml/invoice_detail_item_reference.rb +17 -0
  49. data/lib/cxml/invoice_detail_line_indicator.rb +14 -0
  50. data/lib/cxml/invoice_detail_line_shipping.rb +11 -0
  51. data/lib/cxml/invoice_detail_line_special_handling.rb +11 -0
  52. data/lib/cxml/invoice_detail_order.rb +24 -0
  53. data/lib/cxml/invoice_detail_order_info.rb +10 -0
  54. data/lib/cxml/invoice_detail_order_summary.rb +32 -0
  55. data/lib/cxml/invoice_detail_request.rb +40 -0
  56. data/lib/cxml/invoice_detail_request_header.rb +54 -0
  57. data/lib/cxml/invoice_detail_shipping.rb +27 -0
  58. data/lib/cxml/invoice_detail_summary.rb +18 -0
  59. data/lib/cxml/invoice_id_info.rb +10 -0
  60. data/lib/cxml/invoice_partner.rb +10 -0
  61. data/lib/cxml/item_detail.rb +27 -0
  62. data/lib/cxml/item_id.rb +10 -0
  63. data/lib/cxml/item_in.rb +14 -0
  64. data/lib/cxml/item_out.rb +17 -0
  65. data/lib/cxml/master_agreement_reference.rb +9 -0
  66. data/lib/cxml/message.rb +13 -0
  67. data/lib/cxml/modification.rb +15 -0
  68. data/lib/cxml/modification_detail.rb +16 -0
  69. data/lib/cxml/modifications.rb +23 -0
  70. data/lib/cxml/money.rb +35 -0
  71. data/lib/cxml/name.rb +9 -0
  72. data/lib/cxml/net_amount.rb +9 -0
  73. data/lib/cxml/order_reference.rb +12 -0
  74. data/lib/cxml/order_request.rb +33 -0
  75. data/lib/cxml/order_request_header.rb +66 -0
  76. data/lib/cxml/parser.rb +37 -0
  77. data/lib/cxml/payment_term.rb +28 -0
  78. data/lib/cxml/period.rb +10 -0
  79. data/lib/cxml/postal_address.rb +35 -0
  80. data/lib/cxml/protocol.rb +57 -0
  81. data/lib/cxml/punch_out_order_message.rb +33 -0
  82. data/lib/cxml/punch_out_order_message_header.rb +20 -0
  83. data/lib/cxml/punch_out_setup_request.rb +31 -0
  84. data/lib/cxml/punch_out_setup_response.rb +9 -0
  85. data/lib/cxml/request.rb +21 -0
  86. data/lib/cxml/response.rb +20 -0
  87. data/lib/cxml/segment.rb +12 -0
  88. data/lib/cxml/sender.rb +10 -0
  89. data/lib/cxml/ship_to.rb +10 -0
  90. data/lib/cxml/shipping.rb +10 -0
  91. data/lib/cxml/shipping_amount.rb +10 -0
  92. data/lib/cxml/special_handling_amount.rb +11 -0
  93. data/lib/cxml/start_page.rb +13 -0
  94. data/lib/cxml/state.rb +9 -0
  95. data/lib/cxml/status.rb +27 -0
  96. data/lib/cxml/subtotal_amount.rb +9 -0
  97. data/lib/cxml/supplier_setup.rb +13 -0
  98. data/lib/cxml/tax.rb +42 -0
  99. data/lib/cxml/tax_adjustment_amount.rb +9 -0
  100. data/lib/cxml/tax_amount.rb +9 -0
  101. data/lib/cxml/tax_detail.rb +44 -0
  102. data/lib/cxml/tax_location.rb +9 -0
  103. data/lib/cxml/taxable_amount.rb +9 -0
  104. data/lib/cxml/to.rb +9 -0
  105. data/lib/cxml/total.rb +10 -0
  106. data/lib/cxml/total_allowances.rb +9 -0
  107. data/lib/cxml/total_amount_without_tax.rb +9 -0
  108. data/lib/cxml/total_charges.rb +9 -0
  109. data/lib/cxml/unit_price.rb +9 -0
  110. data/lib/cxml/version.rb +5 -0
  111. data/lib/cxml.rb +39 -0
  112. data/spec/credential_spec.rb +37 -0
  113. data/spec/cxml_spec.rb +6 -0
  114. data/spec/document_spec.rb +155 -0
  115. data/spec/fixtures/.gitkeep +0 -0
  116. data/spec/fixtures/envelope.xml +31 -0
  117. data/spec/fixtures/envelope2.xml +36 -0
  118. data/spec/fixtures/invoice_backed_and_unbacked_by_pos.xml +106 -0
  119. data/spec/fixtures/invoice_backed_by_multiple_pos.xml +97 -0
  120. data/spec/fixtures/invoice_taxes_at_line.xml +82 -0
  121. data/spec/fixtures/invoice_taxes_at_line_multiple_taxes.xml +403 -0
  122. data/spec/fixtures/invoice_taxes_at_total.xml +78 -0
  123. data/spec/fixtures/item_in.xml +11 -0
  124. data/spec/fixtures/order_request.cxml +121 -0
  125. data/spec/fixtures/punch_out_order_message_doc.xml +32 -0
  126. data/spec/fixtures/punch_out_setup_request_doc.xml +32 -0
  127. data/spec/fixtures/punch_out_setup_request_doc_coupa.xml +42 -0
  128. data/spec/fixtures/punch_out_setup_request_doc_with_ship_to.xml +46 -0
  129. data/spec/fixtures/purchase_order_request_200.xml +132 -0
  130. data/spec/fixtures/request_doc.xml +79 -0
  131. data/spec/fixtures/response_status_200.xml +11 -0
  132. data/spec/fixtures/response_status_400.xml +5 -0
  133. data/spec/header_spec.rb +54 -0
  134. data/spec/invoice_detail_request_spec.rb +88 -0
  135. data/spec/item_detail_spec.rb +44 -0
  136. data/spec/item_id_spec.rb +40 -0
  137. data/spec/item_in_spec.rb +41 -0
  138. data/spec/money_spec.rb +44 -0
  139. data/spec/parser_spec.rb +6 -0
  140. data/spec/protocol_spec.rb +16 -0
  141. data/spec/punch_out_order_message_header_spec.rb +36 -0
  142. data/spec/punch_out_order_message_spec.rb +43 -0
  143. data/spec/punch_out_setup_request_spec.rb +60 -0
  144. data/spec/purchase_order_request_spec.rb +40 -0
  145. data/spec/request_spec.rb +36 -0
  146. data/spec/response_spec.rb +58 -0
  147. data/spec/sender_spec.rb +32 -0
  148. data/spec/spec_helper.rb +21 -0
  149. data/spec/status_spec.rb +44 -0
  150. data/spec/support/helpers.rb +5 -0
  151. metadata +317 -0
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CXML::PunchOutOrderMessageHeader do
6
+ it { should respond_to :total }
7
+ it { should respond_to :operation_allowed }
8
+ it { should respond_to :render }
9
+
10
+ let(:parser) { CXML::Parser.new }
11
+ let(:data) { parser.parse(fixture('punch_out_order_message_doc.xml')) }
12
+ let(:doc) { CXML::Document.new(data) }
13
+ let(:punch_out_order_message_header) { doc.message.punch_out_order_message.punch_out_order_message_header }
14
+ let(:builder) { doc.render }
15
+
16
+ describe '#initialize' do
17
+ it 'sets the mandatory attributes' do
18
+ punch_out_order_message_header.total.money.should be_instance_of(CXML::Money)
19
+ end
20
+ end
21
+
22
+ describe '#render' do
23
+ let(:output_xml) { builder.to_xml }
24
+ let(:output_data) { parser.parse(output_xml) }
25
+ let(:punch_out_order_message_output_data) { output_data[:message][:punch_out_order_message] }
26
+ let(:punch_out_order_message_header_output_data) do
27
+ punch_out_order_message_output_data[:punch_out_order_message_header]
28
+ end
29
+
30
+ it 'contains the required nodes' do
31
+ punch_out_order_message_header_output_data[:operation_allowed].should_not be_empty
32
+ punch_out_order_message_header_output_data[:total].should_not be_empty
33
+ punch_out_order_message_header_output_data[:total][:money].should_not be_empty
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CXML::PunchOutOrderMessage do
6
+ it { should respond_to :add_item }
7
+ it { should respond_to :buyer_cookie }
8
+ it { should respond_to :items_in }
9
+ it { should respond_to :render }
10
+
11
+ let(:parser) { CXML::Parser.new }
12
+ let(:data) { parser.parse(fixture('punch_out_order_message_doc.xml')) }
13
+ let(:doc) { CXML::Document.new(data) }
14
+ let(:punch_out_order_message) { doc.message.punch_out_order_message }
15
+ let(:builder) { doc.render }
16
+
17
+ describe '#initialize' do
18
+ it 'sets the mandatory attributes' do
19
+ punch_out_order_message.punch_out_order_message_header
20
+ .should be_an_instance_of CXML::PunchOutOrderMessageHeader
21
+ end
22
+ end
23
+
24
+ describe '#add_item' do
25
+ it 'adds items to the order' do
26
+ punch_out_order_message.add_item(build_item_in(parser))
27
+ punch_out_order_message.items_in.count.should == 1
28
+ end
29
+ end
30
+
31
+ describe '#render' do
32
+ let(:output_xml) { builder.to_xml }
33
+ let(:output_data) { parser.parse(output_xml) }
34
+ let(:punch_out_order_message_output_data) { output_data[:message][:punch_out_order_message] }
35
+
36
+ it 'contains the required nodes' do
37
+ punch_out_order_message.add_item(build_item_in(parser))
38
+ punch_out_order_message_output_data[:punch_out_order_message_header].should_not be_empty
39
+ punch_out_order_message_output_data[:buyer_cookie].should_not be_empty
40
+ punch_out_order_message_output_data.should include(:item_in)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CXML::PunchOutSetupRequest do
6
+ it { should respond_to :browser_form_post }
7
+ it { should respond_to :supplier_setup }
8
+ it { should respond_to :buyer_cookie }
9
+ it { should respond_to :ship_to }
10
+ it { should respond_to :extrinsics }
11
+ it { should respond_to :contact }
12
+
13
+ let(:parser) { CXML::Parser.new }
14
+ let(:data) { parser.parse(fixture('punch_out_setup_request_doc.xml')) }
15
+ let(:data_coupa) { parser.parse(fixture('punch_out_setup_request_doc_coupa.xml')) }
16
+ let(:doc) { CXML::Document.new(data) }
17
+ let(:doc_coupa) { CXML::Document.new(data_coupa) }
18
+ let(:request) { doc.request }
19
+ let(:request_coupa) { doc_coupa.request }
20
+ let(:punch_out_setup_request) { request.punch_out_setup_request }
21
+ let(:punch_out_setup_request_coupa) { request_coupa.punch_out_setup_request }
22
+
23
+ describe '#initialize' do
24
+ it 'sets the mandatory attributes' do
25
+ punch_out_setup_request.browser_form_post.url.should_not be_nil
26
+ punch_out_setup_request.supplier_setup.url.should_not be_nil
27
+ end
28
+ it 'sets the mandatory coupa attributes' do
29
+ punch_out_setup_request_coupa.browser_form_post.url.should_not be_nil
30
+ punch_out_setup_request_coupa.buyer_cookie.should_not be_nil
31
+ punch_out_setup_request_coupa.contact.email.should_not be_nil
32
+ punch_out_setup_request_coupa.extrinsics.should be_a Array
33
+ punch_out_setup_request_coupa.extrinsics.first.should be_a CXML::Extrinsic
34
+ punch_out_setup_request_coupa.extrinsics.first.name.should_not be_nil
35
+ end
36
+ it 'sets the shipping attributes when present' do
37
+ data = parser.parse(fixture('punch_out_setup_request_doc_with_ship_to.xml'))
38
+ doc = CXML::Document.new(data)
39
+ doc.request.punch_out_setup_request.ship_to.should_not be_nil
40
+ doc.request.punch_out_setup_request.ship_to.address.name.should_not be_nil
41
+ end
42
+ end
43
+
44
+ describe '#render' do
45
+ it 'contains the required nodes' do
46
+ parser = CXML::Parser.new
47
+ data = parser.parse(fixture('punch_out_setup_request_doc_with_ship_to.xml'))
48
+ doc = CXML::Document.new(data)
49
+ builder = doc.render
50
+ output_xml = builder.to_xml
51
+ output_data = parser.parse(output_xml)
52
+ output_data[:request][:punch_out_setup_request][:buyer_cookie]
53
+ .should eq data[:request][:punch_out_setup_request][:buyer_cookie]
54
+ output_data[:request][:punch_out_setup_request][:browser_form_post]
55
+ .should eq data[:request][:punch_out_setup_request][:browser_form_post]
56
+ output_data[:request][:punch_out_setup_request][:ship_to][:address]
57
+ .keys.sort.should eq data[:request][:punch_out_setup_request][:ship_to][:address].keys.sort
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CXML::OrderRequest do
6
+ it { should respond_to :render }
7
+ it { should respond_to :order_request_header }
8
+ it { should respond_to :items_out }
9
+
10
+ let(:parser) { CXML::Parser.new }
11
+ let(:data) { parser.parse(fixture('purchase_order_request_200.xml')) }
12
+ let(:doc) { CXML::Document.new(data) }
13
+ let(:order_request) { doc.request.order_request }
14
+ let(:builder) { doc.render }
15
+ let(:output_xml) { builder.to_xml }
16
+ let(:output_data) { parser.parse(output_xml) }
17
+ let(:order_request_output_data) { output_data[:request][:order_request] }
18
+
19
+ describe '#render' do
20
+ it 'contains the required nodes' do
21
+ order_request_output_data[:order_request_header].should_not be_empty
22
+ order_request_output_data[:item_out].should be_a Array
23
+ order_request_output_data[:item_out].length.should eq 2
24
+ end
25
+ end
26
+ describe '#initialize' do
27
+ it 'sets the required nodes' do
28
+ order_request.order_request_header.should_not be_nil
29
+ order_request.order_request_header.order_id.should_not be_nil
30
+ order_request.items_out.first.should_not be_nil
31
+ end
32
+ it 'sets the required nodes via another order request' do
33
+ request = CXML::Document.new.from_xml(fixture('order_request.cxml')).request
34
+ request.order_request.order_request_header.should_not be_nil
35
+ request.order_request.order_request_header.order_id.should_not be_nil
36
+ request.order_request.items_out.first.should_not be_nil
37
+ request.order_request.items_out.first.item_detail.extrinsics.first.should_not be_nil
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CXML::Request do
6
+ it { should respond_to :punch_out_setup_request }
7
+ it { should respond_to :id }
8
+ it { should respond_to :deployment_mode }
9
+
10
+ describe '#initialize' do
11
+ it 'sets punch_out_setup_request attributes' do
12
+ parser = CXML::Parser.new
13
+ data = parser.parse(fixture('punch_out_setup_request_doc.xml'))
14
+ doc = CXML::Document.new(data)
15
+ doc.request.deployment_mode.should_not be_nil
16
+ doc.request.punch_out_setup_request
17
+ .should be_an_instance_of CXML::PunchOutSetupRequest
18
+ end
19
+ it 'sets purchase_order_request attributes' do
20
+ parser = CXML::Parser.new
21
+ data = parser.parse(fixture('purchase_order_request_200.xml'))
22
+ doc = CXML::Document.new(data)
23
+ doc.request.deployment_mode.should_not be_nil
24
+ doc.request.order_request
25
+ .should be_an_instance_of CXML::OrderRequest
26
+ end
27
+ it 'sets invoice_detail_request attributes' do
28
+ parser = CXML::Parser.new
29
+ data = parser.parse(fixture('invoice_taxes_at_line.xml'))
30
+ doc = CXML::Document.new(data)
31
+ doc.request.deployment_mode.should_not be_nil
32
+ doc.request.invoice_detail_request
33
+ .should be_an_instance_of CXML::InvoiceDetailRequest
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CXML::Response do
6
+ it { should respond_to :id }
7
+ it { should respond_to :status }
8
+ it { should respond_to :punch_out_setup_response }
9
+
10
+ let(:parser) { CXML::Parser.new }
11
+ let(:data) { parser.parse(fixture('response_status_200.xml')) }
12
+ let(:doc) { CXML::Document.new(data) }
13
+ let(:response) { doc.response }
14
+ let(:builder) { doc.render }
15
+
16
+ describe '#initialize' do
17
+ it 'sets the mandatory attributes' do
18
+ response.status.should be_an_instance_of CXML::Status
19
+ response.punch_out_setup_response.should be_an_instance_of CXML::PunchOutSetupResponse
20
+ end
21
+ end
22
+
23
+ describe '#render' do
24
+ let(:output_xml) { builder.to_xml }
25
+ let(:output_data) { parser.parse(output_xml) }
26
+
27
+ context 'when a valid response is rendered' do
28
+ let(:data) { parser.parse(fixture('response_status_200.xml')) }
29
+
30
+ it 'returns xml content' do
31
+ output_xml.should_not be_nil
32
+ end
33
+
34
+ it 'outputs the response with a valid status code' do
35
+ output_data[:response].should_not be_empty
36
+ output_data[:response][:punch_out_setup_response].should_not be_empty
37
+ output_data[:response][:status][:code].should == '200'
38
+ end
39
+
40
+ it 'outputs the punch out setup response' do
41
+ output_data[:response][:punch_out_setup_response].should_not be_empty
42
+ end
43
+ end
44
+
45
+ context 'when a invalid response is rendered' do
46
+ let(:data) { parser.parse(fixture('response_status_400.xml')) }
47
+
48
+ it 'returns xml content' do
49
+ output_xml.should_not be_nil
50
+ end
51
+
52
+ it 'outputs the response with a valid status code' do
53
+ output_data[:response].should_not be_empty
54
+ output_data[:response][:status][:code].should == '400'
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CXML::Sender do
6
+ it { should respond_to :credential }
7
+ it { should respond_to :user_agent }
8
+
9
+ let(:parser) { CXML::Parser.new }
10
+ let(:data) { parser.parse(fixture('punch_out_order_message_doc.xml')) }
11
+ let(:doc) { CXML::Document.new(data) }
12
+ let(:sender) { doc.header.sender }
13
+ let(:builder) { doc.render }
14
+
15
+ describe '#initialize' do
16
+ it 'sets the mandatory attributes' do
17
+ sender.credential.should_not be_nil
18
+ sender.user_agent.should_not be_nil
19
+ end
20
+ end
21
+
22
+ describe '#render' do
23
+ let(:output_xml) { builder.to_xml }
24
+ let(:output_data) { parser.parse(output_xml) }
25
+ let(:sender_output_data) { output_data[:header][:sender] }
26
+
27
+ it 'contains the required nodes' do
28
+ sender_output_data[:user_agent].should_not be_empty
29
+ sender_output_data[:credential].should_not be_empty
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('..', __dir__)
4
+
5
+ require 'cxml'
6
+ require 'pry'
7
+
8
+ Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
9
+
10
+ RSpec.configure do |config|
11
+ config.expect_with(:rspec) { |c| c.syntax = :should }
12
+ end
13
+
14
+ def fixture_path(filename = nil)
15
+ path = File.expand_path('fixtures', __dir__)
16
+ filename.nil? ? path : File.join(path, filename)
17
+ end
18
+
19
+ def fixture(file)
20
+ File.read(File.join(fixture_path, file))
21
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe CXML::Status do
6
+ describe 'instance' do
7
+ it { should respond_to :code }
8
+ it { should respond_to :text }
9
+ it { should respond_to :xml_lang }
10
+ it { should respond_to :success? }
11
+ it { should respond_to :failure? }
12
+ end
13
+
14
+ describe '#initialize' do
15
+ it 'assigns attributes from hash' do
16
+ hash = { 'xml_lang' => 'en-US', 'code' => '200', 'text' => 'OK' }
17
+ status = CXML::Status.new(hash)
18
+
19
+ status.code.should eq(200)
20
+ status.xml_lang.should eq('en-US')
21
+ status.text.should eq('OK')
22
+ end
23
+ end
24
+
25
+ describe '#success?' do
26
+ it 'returns true on 2xx codes' do
27
+ CXML::Status.new('code' => '200').success?.should be true
28
+ CXML::Status.new('code' => '201').success?.should be true
29
+ CXML::Status.new('code' => '281').success?.should be true
30
+ end
31
+
32
+ it 'returns false on non 2xx codes' do
33
+ CXML::Status.new('code' => '400').success?.should be false
34
+ CXML::Status.new('code' => '475').success?.should be false
35
+ CXML::Status.new('code' => '500').success?.should be false
36
+ end
37
+ end
38
+
39
+ describe '#failure?' do
40
+ it 'returns false on 2xx codes' do
41
+ CXML::Status.new('code' => '200').failure?.should be false
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ def build_item_in(parser)
4
+ parser.parse(fixture('item_in.xml'))
5
+ end