qbwc_requests 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/qbwc_requests/{qbwc/request/v07/account.rb → account/v07/add.rb} +3 -3
- data/lib/qbwc_requests/account/v07/query.rb +9 -0
- data/lib/qbwc_requests/base.rb +76 -0
- data/lib/qbwc_requests/bill/v07/add.rb +11 -0
- data/lib/qbwc_requests/bill/v07/query.rb +9 -0
- data/lib/qbwc_requests/customer/v07/add.rb +39 -0
- data/lib/qbwc_requests/customer/v07/query.rb +9 -0
- data/lib/qbwc_requests/{qbwc/request/v07/estimate.rb → estimate/v07/add.rb} +5 -4
- data/lib/qbwc_requests/estimate/v07/query.rb +9 -0
- data/lib/qbwc_requests/factory.rb +32 -0
- data/lib/qbwc_requests/general_detail_report/v07/query.rb +9 -0
- data/lib/qbwc_requests/{qbwc/request/v07/invoice.rb → invoice/v07/add.rb} +5 -5
- data/lib/qbwc_requests/invoice/v07/query.rb +9 -0
- data/lib/qbwc_requests/item/v07/query.rb +9 -0
- data/lib/qbwc_requests/{qbwc/request/v07/item_discount.rb → item_discount/v07/add.rb} +5 -4
- data/lib/qbwc_requests/item_discount/v07/query.rb +9 -0
- data/lib/qbwc_requests/{qbwc/request/v07/item_group.rb → item_group/v07/add.rb} +4 -3
- data/lib/qbwc_requests/item_group/v07/query.rb +9 -0
- data/lib/qbwc_requests/{qbwc/request/v07/item_non_inventory.rb → item_non_inventory/v07/add.rb} +5 -4
- data/lib/qbwc_requests/item_non_inventory/v07/query.rb +9 -0
- data/lib/qbwc_requests/{qbwc/request/v07/item_other_charge.rb → item_other_charge/v07/add.rb} +4 -3
- data/lib/qbwc_requests/item_other_charge/v07/query.rb +9 -0
- data/lib/qbwc_requests/{qbwc/request/v07/item_payment.rb → item_payment/v07/add.rb} +4 -3
- data/lib/qbwc_requests/item_payment/v07/query.rb +9 -0
- data/lib/qbwc_requests/{qbwc/request/v07/item_service.rb → item_service/v07/add.rb} +4 -3
- data/lib/qbwc_requests/item_service/v07/query.rb +9 -0
- data/lib/qbwc_requests/{qbwc/request/v07/item_subtotal.rb → item_subtotal/v07/add.rb} +5 -4
- data/lib/qbwc_requests/item_subtotal/v07/query.rb +9 -0
- data/lib/qbwc_requests/ordered_fields.rb +81 -0
- data/lib/qbwc_requests/purchase_order/v07/add.rb +33 -0
- data/lib/qbwc_requests/{qbwc/request/v07/purchase_order.rb → purchase_order/v07/mod.rb} +10 -14
- data/lib/qbwc_requests/purchase_order/v07/query.rb +9 -0
- data/lib/qbwc_requests/sub_models/address.rb +27 -0
- data/lib/qbwc_requests/vendor/v07/add.rb +44 -0
- data/lib/qbwc_requests/vendor/v07/mod.rb +44 -0
- data/lib/qbwc_requests/vendor/v07/query.rb +9 -0
- data/lib/qbwc_requests/vendor/v13/add.rb +44 -0
- data/lib/qbwc_requests/vendor/v13/mod.rb +44 -0
- data/lib/qbwc_requests/vendor/v13/query.rb +9 -0
- data/lib/qbwc_requests/version.rb +1 -1
- data/lib/qbwc_requests/{qbwc/xml_actions.rb → xml_actions.rb} +2 -9
- data/lib/qbwc_requests.rb +51 -5
- data/qbwc_requests.gemspec +4 -2
- data/quickbook/dtd/qbxmlops60.dtd +3043 -0
- data/quickbook/dtd/qbxmlops60_2.dtd +3019 -0
- data/scripts/dtd_to_classes.rb +3 -0
- data/spec/account_qbxml_spec.rb +42 -0
- data/spec/{qbwc/request/v07/bill_spec.rb → bill_qbxml_spec.rb} +10 -5
- data/spec/customer_qbxml_spec.rb +57 -0
- data/spec/{qbwc/request/v07/estimate_spec.rb → estimate_qbxml_spec.rb} +19 -8
- data/spec/general_detail_report_qbxml_spec.rb +9 -0
- data/spec/{qbwc/request/v07/invoice_spec.rb → invoice_qbxml_spec.rb} +11 -9
- data/spec/{qbwc/request/v07/item_discount_spec.rb → item_discount_qbxml_spec.rb} +10 -8
- data/spec/{qbwc/request/v07/item_group_spec.rb → item_group_qbxml_spec.rb} +9 -7
- data/spec/{qbwc/request/v07/item_non_inventory_spec.rb → item_non_inventory_qbxml_spec.rb} +9 -7
- data/spec/{qbwc/request/v07/item_other_charge_spec.rb → item_other_charge_qbxml_spec.rb} +10 -8
- data/spec/{qbwc/request/v07/item_payment_spec.rb → item_payment_qbxml_spec.rb} +10 -7
- data/spec/item_qbxml_spec.rb +9 -0
- data/spec/{qbwc/request/v07/item_service_spec.rb → item_service_qbxml_spec.rb} +9 -7
- data/spec/{qbwc/request/v07/item_subtotal_spec.rb → item_subtotal_qbxml_spec.rb} +12 -10
- data/spec/job_report_qbxml_spec.rb +7 -0
- data/spec/{qbwc/request/v07/purchase_orders_spec.rb → purchase_order_qbxml_spec.rb} +11 -10
- data/spec/spec_helper.rb +5 -0
- data/spec/support/expectations/field_validations.rb +2 -2
- data/spec/support/expectations/xml_equal.rb +4 -2
- data/spec/support/shared_examples_for_xml_requests.rb +18 -20
- data/spec/vendor_qbxml_spec.rb +111 -0
- metadata +113 -68
- data/lib/qbwc_requests/qbwc/ordered_fields.rb +0 -35
- data/lib/qbwc_requests/qbwc/qbwc.rb +0 -2
- data/lib/qbwc_requests/qbwc/request/base.rb +0 -77
- data/lib/qbwc_requests/qbwc/request/v07/bill.rb +0 -9
- data/lib/qbwc_requests/qbwc/request/v07/customer.rb +0 -29
- data/lib/qbwc_requests/qbwc/request/v07/general_detail_report.rb +0 -11
- data/lib/qbwc_requests/qbwc/request/v07/item.rb +0 -11
- data/lib/qbwc_requests/qbwc/request/v07/job_report.rb +0 -3
- data/lib/qbwc_requests/qbwc/request/v07/vendor.rb +0 -31
- data/lib/qbwc_requests/qbwc/request/v07/vendor_address.rb +0 -17
- data/spec/qbwc/request/base_spec.rb +0 -61
- data/spec/qbwc/request/v07/account_spec.rb +0 -32
- data/spec/qbwc/request/v07/customer_spec.rb +0 -32
- data/spec/qbwc/request/v07/general_detail_report_spec.rb +0 -7
- data/spec/qbwc/request/v07/item_spec.rb +0 -7
- data/spec/qbwc/request/v07/job_report_spec.rb +0 -7
- data/spec/qbwc/request/v07/vendor_spec.rb +0 -31
- data/spec/qbwc/request/xml_actions_spec.rb +0 -28
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AccountQbxml do
|
4
|
+
|
5
|
+
describe AccountQbxml::Query do
|
6
|
+
|
7
|
+
context "V07" do
|
8
|
+
it_behaves_like 'queryable'
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
describe AccountQbxml::Add do
|
14
|
+
|
15
|
+
context "V07" do
|
16
|
+
|
17
|
+
it { is_expected.to validate_field_presence_of :name }
|
18
|
+
|
19
|
+
let(:account){ AccountQbxml::Add.factory(name: 'a') }
|
20
|
+
|
21
|
+
it "should create an add account xml" do
|
22
|
+
xml = <<-XML
|
23
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
24
|
+
<?qbxml version="7.0"?>
|
25
|
+
<QBXML>
|
26
|
+
<QBXMLMsgsRq onError="stopOnError">
|
27
|
+
<AccountAddRq requestID="request_id">
|
28
|
+
<AccountAdd>
|
29
|
+
<Name>a</Name>
|
30
|
+
</AccountAdd>
|
31
|
+
</AccountAddRq>
|
32
|
+
</QBXMLMsgsRq>
|
33
|
+
</QBXML>
|
34
|
+
XML
|
35
|
+
expect( account.to_xml("request_id") ).to be_xml_equal_to xml
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -1,27 +1,32 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
describe BillQbxml do
|
4
4
|
|
5
|
-
|
5
|
+
describe BillQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
6
8
|
|
7
9
|
describe "add" do
|
8
10
|
|
9
|
-
let(:bill){
|
11
|
+
let(:bill){ BillQbxml::Add.factory(vendor_ref: {list_id: 10}) }
|
10
12
|
|
11
13
|
it "should create an add bill xml" do
|
12
14
|
xml = <<-XML
|
13
|
-
<?xml version=
|
15
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
14
16
|
<?qbxml version="7.0"?>
|
15
17
|
<QBXML>
|
16
18
|
<QBXMLMsgsRq onError="stopOnError">
|
17
19
|
<BillAddRq requestID="request_id">
|
18
20
|
<BillAdd>
|
21
|
+
<VendorRef>
|
22
|
+
<ListID>10</ListID>
|
23
|
+
</VendorRef>
|
19
24
|
</BillAdd>
|
20
25
|
</BillAddRq>
|
21
26
|
</QBXMLMsgsRq>
|
22
27
|
</QBXML>
|
23
28
|
XML
|
24
|
-
expect( bill.
|
29
|
+
expect( bill.to_xml("request_id") ).to be_xml_equal_to xml
|
25
30
|
end
|
26
31
|
|
27
32
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CustomerQbxml do
|
4
|
+
|
5
|
+
describe CustomerQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe CustomerQbxml::Add do
|
10
|
+
|
11
|
+
it { is_expected.to validate_field_presence_of :name }
|
12
|
+
|
13
|
+
context "valid customer" do
|
14
|
+
let(:customer){ CustomerQbxml::Add.factory(name: 'a') }
|
15
|
+
|
16
|
+
it "should create an add customer xml" do
|
17
|
+
xml = <<-XML
|
18
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
19
|
+
<?qbxml version="7.0"?>
|
20
|
+
<QBXML>
|
21
|
+
<QBXMLMsgsRq onError="stopOnError">
|
22
|
+
<CustomerAddRq requestID="request_id">
|
23
|
+
<CustomerAdd>
|
24
|
+
<Name>a</Name>
|
25
|
+
</CustomerAdd>
|
26
|
+
</CustomerAddRq>
|
27
|
+
</QBXMLMsgsRq>
|
28
|
+
</QBXML>
|
29
|
+
XML
|
30
|
+
expect( customer.to_xml("request_id") ).to be_xml_equal_to xml
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "invalid customer" do
|
35
|
+
let(:customer){ CustomerQbxml::Add.factory(name: 'a', middle_name: '123456') }
|
36
|
+
|
37
|
+
it "should report an error in the main object" do
|
38
|
+
expect(customer.valid?).to eq(false)
|
39
|
+
expect(customer.errors.count).to eq(1)
|
40
|
+
expect(customer.errors.full_messages[0]).to eq('Middle name is too long (maximum is 5 characters)')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "invalid customer address" do
|
45
|
+
let(:bill_address){ QbwcRequests::SubModels::Address.new(postal_code: '0123456789012345') }
|
46
|
+
let(:customer){ CustomerQbxml::Add.factory(bill_address: bill_address) }
|
47
|
+
|
48
|
+
it "it should report an error in a child object" do
|
49
|
+
expect(customer.valid?).to eq(false)
|
50
|
+
expect(customer.errors.count).to eq(2)
|
51
|
+
expect(customer.errors.full_messages).to include("Name can't be blank")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -1,19 +1,30 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe EstimateQbxml do
|
4
4
|
|
5
|
-
|
5
|
+
describe EstimateQbxml::Query do
|
6
6
|
|
7
|
-
|
8
|
-
it{ is_expected.to validate_field_presence_of :estimate_line_add }
|
7
|
+
it_behaves_like 'queryable'
|
9
8
|
|
10
|
-
|
9
|
+
end
|
10
|
+
|
11
|
+
describe EstimateQbxml::Add do
|
12
|
+
|
13
|
+
it{ is_expected.to validate_field_presence_of :customer_ref }
|
14
|
+
it{ is_expected.to validate_field_presence_of :estimate_line_add }
|
11
15
|
|
12
|
-
let(:estimate){
|
16
|
+
let(:estimate){
|
17
|
+
EstimateQbxml::Add.factory(
|
18
|
+
customer_ref: {full_name: 'Some customer name'},
|
19
|
+
estimate_line_add: {
|
20
|
+
item_ref: {full_name: 'Some intem name'}
|
21
|
+
}
|
22
|
+
)
|
23
|
+
}
|
13
24
|
|
14
25
|
it "should create an add estimate xml" do
|
15
26
|
xml = <<-XML
|
16
|
-
<?xml version=
|
27
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
17
28
|
<?qbxml version="7.0"?>
|
18
29
|
<QBXML>
|
19
30
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -32,7 +43,7 @@ RSpec.describe Qbwc::Request::V07::Estimate do
|
|
32
43
|
</QBXMLMsgsRq>
|
33
44
|
</QBXML>
|
34
45
|
XML
|
35
|
-
expect( estimate.
|
46
|
+
expect( estimate.to_xml("request_id") ).to be_xml_equal_to xml
|
36
47
|
end
|
37
48
|
|
38
49
|
end
|
@@ -1,19 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe InvoiceQbxml do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
describe InvoiceQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe InvoiceQbxml::Add do
|
9
10
|
|
10
|
-
|
11
|
+
it{ is_expected.to validate_field_presence_of :customer_ref }
|
12
|
+
it{ is_expected.to validate_field_presence_of :invoice_line_add }
|
11
13
|
|
12
|
-
let(:invoice){
|
14
|
+
let(:invoice){ InvoiceQbxml::Add.factory(customer_ref: {full_name: 'Some customer name'}, invoice_line_add: {item_ref: {full_name: 'Some item name'}}) }
|
13
15
|
|
14
16
|
it "should create an add invoice xml" do
|
15
17
|
xml = <<-XML
|
16
|
-
<?xml version=
|
18
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
17
19
|
<?qbxml version="7.0"?>
|
18
20
|
<QBXML>
|
19
21
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -32,7 +34,7 @@ RSpec.describe Qbwc::Request::V07::Invoice do
|
|
32
34
|
</QBXMLMsgsRq>
|
33
35
|
</QBXML>
|
34
36
|
XML
|
35
|
-
expect( invoice.
|
37
|
+
expect( invoice.to_xml("request_id") ).to be_xml_equal_to xml
|
36
38
|
end
|
37
39
|
|
38
40
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe ItemDiscountQbxml do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
describe ItemDiscountQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe ItemDiscountQbxml::Add do
|
8
10
|
|
9
|
-
|
11
|
+
it{ is_expected.to validate_field_presence_of :name }
|
10
12
|
|
11
|
-
let(:item_discount) {
|
13
|
+
let(:item_discount) { ItemDiscountQbxml::Add.factory(name: 'discount item name') }
|
12
14
|
|
13
15
|
it "should create an add Discount Item xml" do
|
14
16
|
xml = <<-XML
|
15
|
-
<?xml version=
|
17
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
16
18
|
<?qbxml version="7.0"?>
|
17
19
|
<QBXML>
|
18
20
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -24,7 +26,7 @@ describe Qbwc::Request::V07::ItemDiscount do
|
|
24
26
|
</QBXMLMsgsRq>
|
25
27
|
</QBXML>
|
26
28
|
XML
|
27
|
-
expect( item_discount.
|
29
|
+
expect( item_discount.to_xml("request_id") ).to be_xml_equal_to xml
|
28
30
|
end
|
29
31
|
|
30
32
|
end
|
@@ -1,17 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe ItemGroupQbxml do
|
4
4
|
|
5
|
-
|
5
|
+
describe ItemGroupQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
6
8
|
|
7
|
-
|
9
|
+
describe ItemGroupQbxml::Add do
|
8
10
|
|
9
|
-
|
11
|
+
it{ is_expected.to validate_field_presence_of :name }
|
10
12
|
|
11
13
|
it "should create an add Item Group xml" do
|
12
|
-
item =
|
14
|
+
item = ItemGroupQbxml::Add.factory(name: 'Group item name')
|
13
15
|
xml = <<-XML
|
14
|
-
<?xml version=
|
16
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
15
17
|
<?qbxml version="7.0"?>
|
16
18
|
<QBXML>
|
17
19
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -23,7 +25,7 @@ describe Qbwc::Request::V07::ItemGroup do
|
|
23
25
|
</QBXMLMsgsRq>
|
24
26
|
</QBXML>
|
25
27
|
XML
|
26
|
-
expect( item.
|
28
|
+
expect( item.to_xml("request_id") ).to be_xml_equal_to xml
|
27
29
|
end
|
28
30
|
|
29
31
|
end
|
@@ -1,17 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe ItemNonInventoryQbxml do
|
4
4
|
|
5
|
-
|
5
|
+
describe ItemNonInventoryQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
6
8
|
|
7
|
-
|
9
|
+
describe ItemNonInventoryQbxml::Add do
|
8
10
|
|
9
|
-
|
11
|
+
it{ is_expected.to validate_field_presence_of :name }
|
10
12
|
|
11
13
|
it "should create an add Item Non Invetory xml" do
|
12
|
-
item =
|
14
|
+
item = ItemNonInventoryQbxml::Add.factory(name: 'NonInventory item name')
|
13
15
|
xml = <<-XML
|
14
|
-
<?xml version=
|
16
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
15
17
|
<?qbxml version="7.0"?>
|
16
18
|
<QBXML>
|
17
19
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -23,7 +25,7 @@ describe Qbwc::Request::V07::ItemNonInventory do
|
|
23
25
|
</QBXMLMsgsRq>
|
24
26
|
</QBXML>
|
25
27
|
XML
|
26
|
-
expect( item.
|
28
|
+
expect( item.to_xml("request_id") ).to be_xml_equal_to xml
|
27
29
|
end
|
28
30
|
|
29
31
|
end
|
@@ -1,19 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe ItemOtherChargeQbxml do
|
4
4
|
|
5
|
-
|
5
|
+
describe ItemOtherChargeQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
6
8
|
|
7
|
-
|
8
|
-
it{ is_expected.to validate_field_presence_of :sales_or_purchase }
|
9
|
+
describe ItemOtherChargeQbxml::Add do
|
9
10
|
|
10
|
-
|
11
|
+
it{ is_expected.to validate_field_presence_of :name }
|
12
|
+
it{ is_expected.to validate_field_presence_of :sales_or_purchase }
|
11
13
|
|
12
|
-
let(:item){
|
14
|
+
let(:item){ ItemOtherChargeQbxml::Add.factory(name: 'OtherCharge item name', sales_or_purchase: {price: "10.00", account_ref: {full_name: 'Some Account Name'}} ) }
|
13
15
|
|
14
16
|
it "should create an add Item Other Charge xml" do
|
15
17
|
xml = <<-XML
|
16
|
-
<?xml version=
|
18
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
17
19
|
<?qbxml version="7.0"?>
|
18
20
|
<QBXML>
|
19
21
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -31,7 +33,7 @@ describe Qbwc::Request::V07::ItemOtherCharge do
|
|
31
33
|
</QBXMLMsgsRq>
|
32
34
|
</QBXML>
|
33
35
|
XML
|
34
|
-
expect( item.
|
36
|
+
expect( item.to_xml("request_id") ).to be_xml_equal_to xml
|
35
37
|
end
|
36
38
|
|
37
39
|
end
|
@@ -1,16 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe ItemPaymentQbxml do
|
4
4
|
|
5
|
-
|
5
|
+
describe ItemPaymentQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe ItemPaymentQbxml::Add do
|
6
10
|
|
7
|
-
|
11
|
+
it { is_expected.to validate_field_presence_of :name }
|
8
12
|
|
9
|
-
describe "add" do
|
10
13
|
it "should create an add Item Payment xml" do
|
11
|
-
item =
|
14
|
+
item = ItemPaymentQbxml::Add.factory(name: 'Payment item name')
|
12
15
|
xml = <<-XML
|
13
|
-
<?xml version=
|
16
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
14
17
|
<?qbxml version="7.0"?>
|
15
18
|
<QBXML>
|
16
19
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -22,7 +25,7 @@ describe Qbwc::Request::V07::ItemPayment do
|
|
22
25
|
</QBXMLMsgsRq>
|
23
26
|
</QBXML>
|
24
27
|
XML
|
25
|
-
expect( item.
|
28
|
+
expect( item.to_xml("request_id") ).to be_xml_equal_to xml
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
@@ -1,18 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe ItemServiceQbxml do
|
4
4
|
|
5
|
-
|
5
|
+
describe ItemServiceQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
6
8
|
|
7
|
-
|
9
|
+
describe ItemServiceQbxml::Add do
|
8
10
|
|
9
|
-
|
11
|
+
it { is_expected.to validate_field_presence_of :name }
|
10
12
|
|
11
|
-
let(:item) {
|
13
|
+
let(:item) { ItemServiceQbxml::Add.factory(name: 'Service item name') }
|
12
14
|
|
13
15
|
it "should create an add Item Service xml" do
|
14
16
|
xml = <<-XML
|
15
|
-
<?xml version=
|
17
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
16
18
|
<?qbxml version="7.0"?>
|
17
19
|
<QBXML>
|
18
20
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -24,7 +26,7 @@ describe Qbwc::Request::V07::ItemService do
|
|
24
26
|
</QBXMLMsgsRq>
|
25
27
|
</QBXML>
|
26
28
|
XML
|
27
|
-
expect( item.
|
29
|
+
expect( item.to_xml("request_id") ).to be_xml_equal_to xml
|
28
30
|
end
|
29
31
|
|
30
32
|
end
|
@@ -1,19 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe ItemSubtotalQbxml do
|
4
4
|
|
5
|
-
|
5
|
+
describe ItemSubtotalQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
6
8
|
|
7
|
-
|
9
|
+
describe ItemSubtotalQbxml::Add do
|
8
10
|
|
9
|
-
|
11
|
+
it { is_expected.to validate_field_presence_of :name }
|
10
12
|
|
11
|
-
let(:item) {
|
12
|
-
let(:item_with_bar_code) {
|
13
|
+
let(:item) { ItemSubtotalQbxml::Add.factory(name: 'Subtotal item name') }
|
14
|
+
let(:item_with_bar_code) { ItemSubtotalQbxml::Add.factory(name: 'Subtotal item name', bar_code: { bar_code_value: 'some bar code value' } ) }
|
13
15
|
|
14
16
|
it "should create an add Item Subtotal xml" do
|
15
17
|
xml = <<-XML
|
16
|
-
<?xml version=
|
18
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
17
19
|
<?qbxml version="7.0"?>
|
18
20
|
<QBXML>
|
19
21
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -25,12 +27,12 @@ describe Qbwc::Request::V07::ItemSubtotal do
|
|
25
27
|
</QBXMLMsgsRq>
|
26
28
|
</QBXML>
|
27
29
|
XML
|
28
|
-
expect( item.
|
30
|
+
expect( item.to_xml("request_id") ).to be_xml_equal_to xml
|
29
31
|
end
|
30
32
|
|
31
33
|
it "should create an add Item Subtotal with the bar_code" do
|
32
34
|
xml = <<-XML
|
33
|
-
<?xml version=
|
35
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
34
36
|
<?qbxml version="7.0"?>
|
35
37
|
<QBXML>
|
36
38
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -45,7 +47,7 @@ describe Qbwc::Request::V07::ItemSubtotal do
|
|
45
47
|
</QBXMLMsgsRq>
|
46
48
|
</QBXML>
|
47
49
|
XML
|
48
|
-
expect( item_with_bar_code.
|
50
|
+
expect( item_with_bar_code.to_xml("request_id") ).to be_xml_equal_to xml
|
49
51
|
end
|
50
52
|
|
51
53
|
end
|
@@ -1,16 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe PurchaseOrderQbxml do
|
4
4
|
|
5
|
-
|
5
|
+
describe PurchaseOrderQbxml::Query do
|
6
|
+
it_behaves_like 'queryable'
|
7
|
+
end
|
6
8
|
|
7
|
-
describe
|
9
|
+
describe PurchaseOrderQbxml::Add do
|
8
10
|
|
9
|
-
let(:purchase_order){
|
11
|
+
let(:purchase_order){ PurchaseOrderQbxml::Add.factory(vendor_ref: {full_name: "Vendor full name"}, purchase_order_line_add: {item_ref: {full_name: 'Some item ref full name'}}) }
|
10
12
|
|
11
13
|
it "should create an add purchase order xml" do
|
12
14
|
xml = <<-XML
|
13
|
-
<?xml version=
|
15
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
14
16
|
<?qbxml version="7.0"?>
|
15
17
|
<QBXML>
|
16
18
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -29,18 +31,18 @@ RSpec.describe Qbwc::Request::V07::PurchaseOrder do
|
|
29
31
|
</QBXMLMsgsRq>
|
30
32
|
</QBXML>
|
31
33
|
XML
|
32
|
-
expect( purchase_order.
|
34
|
+
expect( purchase_order.to_xml("request_id") ).to be_xml_equal_to xml
|
33
35
|
end
|
34
36
|
|
35
37
|
end
|
36
38
|
|
37
39
|
describe "update" do
|
38
40
|
|
39
|
-
let(:purchase_order){
|
41
|
+
let(:purchase_order){ PurchaseOrderQbxml::Mod.factory(vendor_ref: {full_name: "Vendor full name"}, purchase_order_line_mod: {item_ref: {full_name: 'Some item ref full name'}}) }
|
40
42
|
|
41
43
|
it "should create an add purchase order xml" do
|
42
44
|
xml = <<-XML
|
43
|
-
<?xml version=
|
45
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
44
46
|
<?qbxml version="7.0"?>
|
45
47
|
<QBXML>
|
46
48
|
<QBXMLMsgsRq onError="stopOnError">
|
@@ -59,10 +61,9 @@ RSpec.describe Qbwc::Request::V07::PurchaseOrder do
|
|
59
61
|
</QBXMLMsgsRq>
|
60
62
|
</QBXML>
|
61
63
|
XML
|
62
|
-
expect( purchase_order.
|
64
|
+
expect( purchase_order.to_xml("request_id") ).to be_xml_equal_to xml
|
63
65
|
end
|
64
66
|
|
65
|
-
|
66
67
|
end
|
67
68
|
|
68
69
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
+
require 'codeclimate-test-reporter'
|
2
|
+
CodeClimate::TestReporter.start
|
1
3
|
require 'rubygems'
|
4
|
+
require 'colorize'
|
2
5
|
require 'bundler/setup'
|
3
6
|
require 'i18n'
|
4
7
|
|
8
|
+
|
5
9
|
I18n.config.enforce_available_locales = true
|
6
10
|
Bundler.require :default
|
7
11
|
|
12
|
+
|
8
13
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
9
14
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
10
15
|
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
@@ -1,7 +1,7 @@
|
|
1
1
|
RSpec::Matchers.define :validate_field_presence_of do |expected|
|
2
2
|
|
3
3
|
match do |actual|
|
4
|
-
object = described_class.
|
4
|
+
object = described_class.factory()
|
5
5
|
object.valid?
|
6
6
|
object.errors.include? expected
|
7
7
|
end
|
@@ -10,4 +10,4 @@ RSpec::Matchers.define :validate_field_presence_of do |expected|
|
|
10
10
|
"Expected model to include validation errors for #{expected}"
|
11
11
|
end
|
12
12
|
|
13
|
-
end
|
13
|
+
end
|
@@ -9,7 +9,9 @@ RSpec::Matchers.define :be_xml_equal_to do |expected|
|
|
9
9
|
end
|
10
10
|
|
11
11
|
failure_message do |actual|
|
12
|
-
"
|
12
|
+
"EXPECTED: \n#{clean(expected).colorize(:green)}
|
13
|
+
\nFOUND: \n#{clean(actual).colorize(:red)}
|
14
|
+
"
|
13
15
|
end
|
14
16
|
|
15
|
-
end
|
17
|
+
end
|