netsuite 0.3.0 → 0.3.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.
- data/README.md +1 -1
- data/lib/netsuite.rb +0 -1
- data/lib/netsuite/actions/search.rb +5 -0
- data/lib/netsuite/records/file.rb +3 -8
- data/lib/netsuite/support/country.rb +2 -2
- data/lib/netsuite/version.rb +1 -1
- data/netsuite.gemspec +1 -1
- data/spec/netsuite/actions/add_spec.rb +14 -14
- data/spec/netsuite/actions/delete_spec.rb +2 -2
- data/spec/netsuite/actions/get_spec.rb +3 -3
- data/spec/netsuite/actions/initialize_spec.rb +2 -2
- data/spec/netsuite/actions/search_spec.rb +6 -6
- data/spec/netsuite/actions/update_spec.rb +16 -16
- data/spec/netsuite/actions/upsert_list_spec.rb +4 -4
- data/spec/netsuite/actions/upsert_spec.rb +14 -14
- data/spec/netsuite/configuration_spec.rb +21 -21
- data/spec/netsuite/records/account_spec.rb +16 -16
- data/spec/netsuite/records/accounting_period_spec.rb +16 -16
- data/spec/netsuite/records/assembly_item_spec.rb +2 -2
- data/spec/netsuite/records/bill_address_spec.rb +3 -3
- data/spec/netsuite/records/billing_schedule_milestone_list_spec.rb +4 -4
- data/spec/netsuite/records/billing_schedule_milestone_spec.rb +6 -6
- data/spec/netsuite/records/billing_schedule_recurrence_list_spec.rb +4 -4
- data/spec/netsuite/records/billing_schedule_recurrence_spec.rb +6 -6
- data/spec/netsuite/records/billing_schedule_spec.rb +20 -20
- data/spec/netsuite/records/campaign_spec.rb +7 -7
- data/spec/netsuite/records/classification_spec.rb +10 -10
- data/spec/netsuite/records/credit_memo_apply_list_spec.rb +2 -2
- data/spec/netsuite/records/credit_memo_apply_spec.rb +1 -1
- data/spec/netsuite/records/credit_memo_item_list_spec.rb +2 -2
- data/spec/netsuite/records/credit_memo_item_spec.rb +2 -2
- data/spec/netsuite/records/credit_memo_spec.rb +26 -26
- data/spec/netsuite/records/custom_field_list_spec.rb +10 -10
- data/spec/netsuite/records/custom_list_spec.rb +3 -3
- data/spec/netsuite/records/custom_record_spec.rb +20 -20
- data/spec/netsuite/records/custom_record_type_spec.rb +16 -16
- data/spec/netsuite/records/customer_addressbook_list_spec.rb +2 -2
- data/spec/netsuite/records/customer_addressbook_spec.rb +38 -28
- data/spec/netsuite/records/customer_payment_spec.rb +23 -23
- data/spec/netsuite/records/customer_refund_apply_list_spec.rb +2 -2
- data/spec/netsuite/records/customer_refund_apply_spec.rb +1 -1
- data/spec/netsuite/records/customer_refund_deposit_list_spec.rb +2 -2
- data/spec/netsuite/records/customer_refund_deposit_spec.rb +1 -1
- data/spec/netsuite/records/customer_refund_spec.rb +28 -28
- data/spec/netsuite/records/customer_spec.rb +24 -24
- data/spec/netsuite/records/department_spec.rb +16 -16
- data/spec/netsuite/records/deposit_spec.rb +24 -24
- data/spec/netsuite/records/discount_item_spec.rb +19 -19
- data/spec/netsuite/records/duration_spec.rb +1 -1
- data/spec/netsuite/records/inventory_item_spec.rb +18 -18
- data/spec/netsuite/records/inventory_transfer_spec.rb +5 -5
- data/spec/netsuite/records/invoice_item_list_spec.rb +4 -4
- data/spec/netsuite/records/invoice_item_spec.rb +11 -11
- data/spec/netsuite/records/invoice_spec.rb +32 -32
- data/spec/netsuite/records/item_fulfillment_package_list_spec.rb +2 -2
- data/spec/netsuite/records/job_spec.rb +31 -31
- data/spec/netsuite/records/journal_entry_line_list_spec.rb +2 -2
- data/spec/netsuite/records/journal_entry_line_spec.rb +7 -7
- data/spec/netsuite/records/journal_entry_spec.rb +25 -25
- data/spec/netsuite/records/location_spec.rb +8 -8
- data/spec/netsuite/records/non_inventory_sale_item_spec.rb +20 -20
- data/spec/netsuite/records/payment_method_spec.rb +8 -8
- data/spec/netsuite/records/phone_call_spec.rb +2 -2
- data/spec/netsuite/records/pomo_code_spec.rb +7 -7
- data/spec/netsuite/records/record_ref_spec.rb +12 -12
- data/spec/netsuite/records/rev_rec_template_spec.rb +7 -7
- data/spec/netsuite/records/sales_order_item_list_spec.rb +2 -2
- data/spec/netsuite/records/sales_order_item_spec.rb +2 -2
- data/spec/netsuite/records/sales_order_spec.rb +23 -23
- data/spec/netsuite/records/sales_tax_item_spec.rb +2 -2
- data/spec/netsuite/records/service_sale_item_spec.rb +20 -20
- data/spec/netsuite/records/ship_address_spec.rb +3 -3
- data/spec/netsuite/records/site_category_spec.rb +8 -8
- data/spec/netsuite/records/subsidiary_spec.rb +2 -2
- data/spec/netsuite/records/support_case_spec.rb +25 -25
- data/spec/netsuite/records/tax_type_spec.rb +1 -1
- data/spec/netsuite/records/term_spec.rb +15 -15
- data/spec/netsuite/records/units_type_spec.rb +4 -4
- data/spec/netsuite/records/units_type_uom_list_spec.rb +4 -4
- data/spec/netsuite/records/units_type_uom_spec.rb +1 -1
- data/spec/netsuite/records/work_order_item_list_spec.rb +2 -2
- data/spec/netsuite/records/work_order_item_spec.rb +4 -4
- data/spec/netsuite/records/work_order_spec.rb +13 -13
- data/spec/netsuite/response_spec.rb +4 -4
- data/spec/netsuite/support/fields_spec.rb +6 -6
- data/spec/netsuite/support/record_refs_spec.rb +1 -1
- data/spec/netsuite/support/records_spec.rb +2 -2
- data/spec/netsuite/support/requests_spec.rb +6 -6
- data/spec/netsuite_spec.rb +4 -4
- data/spec/spec_helper.rb +0 -2
- data/spec/support/read_only_field_matcher.rb +1 -1
- data/spec/support/record_ref_matcher.rb +2 -2
- metadata +4 -4
|
@@ -20,12 +20,12 @@ describe NetSuite::Records::NonInventorySaleItem do
|
|
|
20
20
|
:store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component, :use_marginal_rates,
|
|
21
21
|
:vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :weight, :weight_unit, :weight_units
|
|
22
22
|
].each do |field|
|
|
23
|
-
item.
|
|
23
|
+
expect(item).to have_field(field)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# TODO there is a probably a more robust way to test this
|
|
27
|
-
item.custom_field_list.class.
|
|
28
|
-
item.pricing_matrix.class.
|
|
27
|
+
expect(item.custom_field_list.class).to eq(NetSuite::Records::CustomFieldList)
|
|
28
|
+
expect(item.pricing_matrix.class).to eq(NetSuite::Records::PricingMatrix)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it 'has the right record_refs' do
|
|
@@ -35,7 +35,7 @@ describe NetSuite::Records::NonInventorySaleItem do
|
|
|
35
35
|
:rev_rec_schedule, :sale_unit, :sales_tax_code, :ship_package, :store_display_image, :store_display_thumbnail,
|
|
36
36
|
:store_item_template, :subsidiary_list, :tax_schedule, :units_type
|
|
37
37
|
].each do |record_ref|
|
|
38
|
-
item.
|
|
38
|
+
expect(item).to have_record_ref(record_ref)
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -44,10 +44,10 @@ describe NetSuite::Records::NonInventorySaleItem do
|
|
|
44
44
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :manufacturer_zip => '90401' }) }
|
|
45
45
|
|
|
46
46
|
it 'returns a NonInventorySaleItem instance populated with the data from the response object' do
|
|
47
|
-
NetSuite::Actions::Get.
|
|
47
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::NonInventorySaleItem, {:external_id => 20}], {}).and_return(response)
|
|
48
48
|
customer = NetSuite::Records::NonInventorySaleItem.get(:external_id => 20)
|
|
49
|
-
customer.
|
|
50
|
-
customer.manufacturer_zip.
|
|
49
|
+
expect(customer).to be_kind_of(NetSuite::Records::NonInventorySaleItem)
|
|
50
|
+
expect(customer.manufacturer_zip).to eql('90401')
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -55,10 +55,10 @@ describe NetSuite::Records::NonInventorySaleItem do
|
|
|
55
55
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
56
56
|
|
|
57
57
|
it 'raises a RecordNotFound exception' do
|
|
58
|
-
NetSuite::Actions::Get.
|
|
59
|
-
|
|
58
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::NonInventorySaleItem, {:external_id => 20}], {}).and_return(response)
|
|
59
|
+
expect {
|
|
60
60
|
NetSuite::Records::NonInventorySaleItem.get(:external_id => 20)
|
|
61
|
-
}.
|
|
61
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
62
62
|
/NetSuite::Records::NonInventorySaleItem with OPTIONS=(.*) could not be found/)
|
|
63
63
|
end
|
|
64
64
|
end
|
|
@@ -71,10 +71,10 @@ describe NetSuite::Records::NonInventorySaleItem do
|
|
|
71
71
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
|
72
72
|
|
|
73
73
|
it 'returns true' do
|
|
74
|
-
NetSuite::Actions::Add.
|
|
74
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
75
75
|
with([item], {}).
|
|
76
76
|
and_return(response)
|
|
77
|
-
item.add.
|
|
77
|
+
expect(item.add).to be_truthy
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
|
|
@@ -82,10 +82,10 @@ describe NetSuite::Records::NonInventorySaleItem do
|
|
|
82
82
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
83
83
|
|
|
84
84
|
it 'returns false' do
|
|
85
|
-
NetSuite::Actions::Add.
|
|
85
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
86
86
|
with([item], {}).
|
|
87
87
|
and_return(response)
|
|
88
|
-
item.add.
|
|
88
|
+
expect(item.add).to be_falsey
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
91
|
end
|
|
@@ -95,10 +95,10 @@ describe NetSuite::Records::NonInventorySaleItem do
|
|
|
95
95
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
|
96
96
|
|
|
97
97
|
it 'returns true' do
|
|
98
|
-
NetSuite::Actions::Delete.
|
|
98
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
99
99
|
with([item], {}).
|
|
100
100
|
and_return(response)
|
|
101
|
-
item.delete.
|
|
101
|
+
expect(item.delete).to be_truthy
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
|
|
@@ -106,10 +106,10 @@ describe NetSuite::Records::NonInventorySaleItem do
|
|
|
106
106
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
107
107
|
|
|
108
108
|
it 'returns false' do
|
|
109
|
-
NetSuite::Actions::Delete.
|
|
109
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
110
110
|
with([item], {}).
|
|
111
111
|
and_return(response)
|
|
112
|
-
item.delete.
|
|
112
|
+
expect(item.delete).to be_falsey
|
|
113
113
|
end
|
|
114
114
|
end
|
|
115
115
|
end
|
|
@@ -125,13 +125,13 @@ describe NetSuite::Records::NonInventorySaleItem do
|
|
|
125
125
|
'listAcct:handlingCost' => 100.0,
|
|
126
126
|
'listAcct:isOnline' => true
|
|
127
127
|
}
|
|
128
|
-
item.to_record.
|
|
128
|
+
expect(item.to_record).to eql(record)
|
|
129
129
|
end
|
|
130
130
|
end
|
|
131
131
|
|
|
132
132
|
describe '#record_type' do
|
|
133
133
|
it 'returns a string of the SOAP type' do
|
|
134
|
-
item.record_type.
|
|
134
|
+
expect(item.record_type).to eql('listAcct:NonInventorySaleItem')
|
|
135
135
|
end
|
|
136
136
|
end
|
|
137
137
|
|
|
@@ -8,7 +8,7 @@ describe NetSuite::Records::PaymentMethod do
|
|
|
8
8
|
:credit_card, :express_checkout_arrangement, :is_debit_card, :is_inactive, :is_online, :name, :pay_pal_email_address,
|
|
9
9
|
:undep_funds, :use_express_checkout
|
|
10
10
|
].each do |field|
|
|
11
|
-
payment_method.
|
|
11
|
+
expect(payment_method).to have_field(field)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ describe NetSuite::Records::PaymentMethod do
|
|
|
16
16
|
[
|
|
17
17
|
:account
|
|
18
18
|
].each do |record_ref|
|
|
19
|
-
payment_method.
|
|
19
|
+
expect(payment_method).to have_record_ref(record_ref)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -30,10 +30,10 @@ describe NetSuite::Records::PaymentMethod do
|
|
|
30
30
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :is_debit_card => true }) }
|
|
31
31
|
|
|
32
32
|
it 'returns an PaymentMethod instance populated with the data from the response object' do
|
|
33
|
-
NetSuite::Actions::Get.
|
|
33
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::PaymentMethod, :external_id => 10], {}).and_return(response)
|
|
34
34
|
payment_method = NetSuite::Records::PaymentMethod.get(:external_id => 10)
|
|
35
|
-
payment_method.
|
|
36
|
-
payment_method.is_debit_card.
|
|
35
|
+
expect(payment_method).to be_kind_of(NetSuite::Records::PaymentMethod)
|
|
36
|
+
expect(payment_method.is_debit_card).to be_truthy
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
@@ -41,10 +41,10 @@ describe NetSuite::Records::PaymentMethod do
|
|
|
41
41
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
42
42
|
|
|
43
43
|
it 'raises a RecordNotFound exception' do
|
|
44
|
-
NetSuite::Actions::Get.
|
|
45
|
-
|
|
44
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::PaymentMethod, :external_id => 10], {}).and_return(response)
|
|
45
|
+
expect {
|
|
46
46
|
NetSuite::Records::PaymentMethod.get(:external_id => 10)
|
|
47
|
-
}.
|
|
47
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
48
48
|
/NetSuite::Records::PaymentMethod with OPTIONS=(.*) could not be found/)
|
|
49
49
|
end
|
|
50
50
|
end
|
|
@@ -5,13 +5,13 @@ describe NetSuite::Records::PhoneCall do
|
|
|
5
5
|
|
|
6
6
|
it "has the right fields" do
|
|
7
7
|
[:title, :message, :phone, :status, :priority, :start_date, :end_date, :completed_date, :timed_event, :access_level].each do |f|
|
|
8
|
-
phone_call.
|
|
8
|
+
expect(phone_call).to have_field(f)
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it 'has the right record refs' do
|
|
13
13
|
[:assigned, :owner, :company, :contact].each do |rr|
|
|
14
|
-
phone_call.
|
|
14
|
+
expect(phone_call).to have_record_ref(rr)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -8,7 +8,7 @@ describe NetSuite::Records::PromotionCode do
|
|
|
8
8
|
:exclude_items, :is_inactive, :is_public, :minimum_order_amount, :name, :number_to_generate,
|
|
9
9
|
:rate, :start_date
|
|
10
10
|
].each do |field|
|
|
11
|
-
promo_code.
|
|
11
|
+
expect(promo_code).to have_field(field)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -17,10 +17,10 @@ describe NetSuite::Records::PromotionCode do
|
|
|
17
17
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :code => 'SUMMERSALE' }) }
|
|
18
18
|
|
|
19
19
|
it 'returns a Campaign instance populated with the data from the response object' do
|
|
20
|
-
NetSuite::Actions::Get.
|
|
20
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::PromotionCode, {:external_id => 1}], {}).and_return(response)
|
|
21
21
|
promo_code = NetSuite::Records::PromotionCode.get(:external_id => 1)
|
|
22
|
-
promo_code.
|
|
23
|
-
promo_code.code.
|
|
22
|
+
expect(promo_code).to be_kind_of(NetSuite::Records::PromotionCode)
|
|
23
|
+
expect(promo_code.code).to eql('SUMMERSALE')
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -28,10 +28,10 @@ describe NetSuite::Records::PromotionCode do
|
|
|
28
28
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
29
29
|
|
|
30
30
|
it 'raises a RecordNotFound exception' do
|
|
31
|
-
NetSuite::Actions::Get.
|
|
32
|
-
|
|
31
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::PromotionCode, {:external_id => 1}], {}).and_return(response)
|
|
32
|
+
expect {
|
|
33
33
|
NetSuite::Records::PromotionCode.get(:external_id => 1)
|
|
34
|
-
}.
|
|
34
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
35
35
|
/NetSuite::Records::PromotionCode with OPTIONS=(.*) could not be found/)
|
|
36
36
|
end
|
|
37
37
|
end
|
|
@@ -7,26 +7,26 @@ describe NetSuite::Records::RecordRef do
|
|
|
7
7
|
context 'when passing in as plain attribute to initialize' do
|
|
8
8
|
it 'correctly sets the internal_id' do
|
|
9
9
|
record_ref = NetSuite::Records::RecordRef.new(:internal_id => '1')
|
|
10
|
-
record_ref.internal_id.
|
|
10
|
+
expect(record_ref.internal_id).to eql('1')
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
context 'when passing in as swirly attributes to initialize' do
|
|
15
15
|
it 'correctly sets the internal_id' do
|
|
16
16
|
record_ref = NetSuite::Records::RecordRef.new(:@internal_id => '2')
|
|
17
|
-
record_ref.internal_id.
|
|
17
|
+
expect(record_ref.internal_id).to eql('2')
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
context 'when not passed in as an attribute to initialize' do
|
|
22
22
|
it 'does not set an internal_id' do
|
|
23
23
|
record_ref = NetSuite::Records::RecordRef.new
|
|
24
|
-
record_ref.internal_id.
|
|
24
|
+
expect(record_ref.internal_id).to be_nil
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it 'has no public internal_id setter' do
|
|
29
|
-
record_ref.
|
|
29
|
+
expect(record_ref).not_to respond_to(:internal_id=)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -40,8 +40,8 @@ describe NetSuite::Records::RecordRef do
|
|
|
40
40
|
|
|
41
41
|
context 'readers' do
|
|
42
42
|
it 'can take on arbitrary attributes into itself on initialization' do
|
|
43
|
-
record_ref.name.
|
|
44
|
-
record_ref.banana.
|
|
43
|
+
expect(record_ref.name).to eql('This is a record_ref')
|
|
44
|
+
expect(record_ref.banana).to eql('for monkeys')
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
|
@@ -54,7 +54,7 @@ describe NetSuite::Records::RecordRef do
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
it 'ignores untouchable attributes' do
|
|
57
|
-
record_ref.instance_variable_get('@attributes').keys.
|
|
57
|
+
expect(record_ref.instance_variable_get('@attributes').keys).not_to include(:"@xmlns:platform_core")
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
@@ -62,9 +62,9 @@ describe NetSuite::Records::RecordRef do
|
|
|
62
62
|
it 'initializes a new ref with the proper attributes from the record' do
|
|
63
63
|
record = NetSuite::Records::Classification.new(:is_inactive => false, :name => 'Retail', :internal_id => '9')
|
|
64
64
|
record_ref = NetSuite::Records::RecordRef.new(record)
|
|
65
|
-
record_ref.
|
|
66
|
-
record_ref.internal_id.
|
|
67
|
-
record_ref.type.
|
|
65
|
+
expect(record_ref).to be_kind_of(NetSuite::Records::RecordRef)
|
|
66
|
+
expect(record_ref.internal_id).to eql('9')
|
|
67
|
+
expect(record_ref.type).to eql('classification')
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
|
|
@@ -74,13 +74,13 @@ describe NetSuite::Records::RecordRef do
|
|
|
74
74
|
record = {
|
|
75
75
|
'platformCore:something' => 'blah'
|
|
76
76
|
}
|
|
77
|
-
record_ref.to_record.
|
|
77
|
+
expect(record_ref.to_record).to eql(record)
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
describe '#record_type' do
|
|
82
82
|
it 'returns a string of the SOAP type' do
|
|
83
|
-
record_ref.record_type.
|
|
83
|
+
expect(record_ref.record_type).to eql('platformCore:RecordRef')
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
|
|
@@ -7,7 +7,7 @@ describe NetSuite::Records::RevRecTemplate do
|
|
|
7
7
|
[
|
|
8
8
|
:name, :is_inactive
|
|
9
9
|
].each do |field|
|
|
10
|
-
template.
|
|
10
|
+
expect(template).to have_field(field)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -16,10 +16,10 @@ describe NetSuite::Records::RevRecTemplate do
|
|
|
16
16
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :name => 'A template' }) }
|
|
17
17
|
|
|
18
18
|
it 'returns an RevRecTemplate instance populated with the data from the response object' do
|
|
19
|
-
NetSuite::Actions::Get.
|
|
19
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::RevRecTemplate, :external_id => 10], {}).and_return(response)
|
|
20
20
|
template = NetSuite::Records::RevRecTemplate.get(:external_id => 10)
|
|
21
|
-
template.
|
|
22
|
-
template.name.
|
|
21
|
+
expect(template).to be_kind_of(NetSuite::Records::RevRecTemplate)
|
|
22
|
+
expect(template.name).to eql('A template')
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -27,10 +27,10 @@ describe NetSuite::Records::RevRecTemplate do
|
|
|
27
27
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
28
28
|
|
|
29
29
|
it 'raises a RecordNotFound exception' do
|
|
30
|
-
NetSuite::Actions::Get.
|
|
31
|
-
|
|
30
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::RevRecTemplate, :external_id => 10], {}).and_return(response)
|
|
31
|
+
expect {
|
|
32
32
|
NetSuite::Records::RevRecTemplate.get(:external_id => 10)
|
|
33
|
-
}.
|
|
33
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
34
34
|
/NetSuite::Records::RevRecTemplate with OPTIONS=(.*) could not be found/)
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -4,7 +4,7 @@ describe NetSuite::Records::SalesOrderItemList do
|
|
|
4
4
|
let(:list) { NetSuite::Records::SalesOrderItemList.new }
|
|
5
5
|
|
|
6
6
|
it 'has a items attribute' do
|
|
7
|
-
list.items.
|
|
7
|
+
expect(list.items).to be_kind_of(Array)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe '#to_record' do
|
|
@@ -20,7 +20,7 @@ describe NetSuite::Records::SalesOrderItemList do
|
|
|
20
20
|
'tranSales:rate' => 10
|
|
21
21
|
}]
|
|
22
22
|
}
|
|
23
|
-
list.to_record.
|
|
23
|
+
expect(list.to_record).to eql(record)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -11,7 +11,7 @@ describe NetSuite::Records::SalesOrderItem do
|
|
|
11
11
|
:tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount,
|
|
12
12
|
:vsoe_price
|
|
13
13
|
].each do |field|
|
|
14
|
-
item.
|
|
14
|
+
expect(item).to have_field(field)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ describe NetSuite::Records::SalesOrderItem do
|
|
|
19
19
|
[
|
|
20
20
|
:department, :item, :job, :klass, :location, :price, :rev_rec_schedule, :tax_code, :units
|
|
21
21
|
].each do |record_ref|
|
|
22
|
-
item.
|
|
22
|
+
expect(item).to have_record_ref(record_ref)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -19,7 +19,7 @@ describe NetSuite::Records::SalesOrder do
|
|
|
19
19
|
:total, :total_cost_estimate, :tran_date, :tran_id, :tran_is_vsoe_bundle, :unapplied, :vat_reg_num,
|
|
20
20
|
:vsoe_auto_calc, :cc_approved
|
|
21
21
|
].each do |field|
|
|
22
|
-
salesorder.
|
|
22
|
+
expect(salesorder).to have_field(field)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -30,7 +30,7 @@ describe NetSuite::Records::SalesOrder do
|
|
|
30
30
|
:opportunity, :partner, :posting_period, :promo_code, :sales_group, :sales_rep,
|
|
31
31
|
:ship_method, :shipping_tax_code, :subsidiary, :tax_item
|
|
32
32
|
].each do |record_ref|
|
|
33
|
-
salesorder.
|
|
33
|
+
expect(salesorder).to have_record_ref(record_ref)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -47,14 +47,14 @@ describe NetSuite::Records::SalesOrder do
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
salesorder.item_list = attributes
|
|
50
|
-
salesorder.item_list.
|
|
51
|
-
salesorder.item_list.items.length.
|
|
50
|
+
expect(salesorder.item_list).to be_kind_of(NetSuite::Records::SalesOrderItemList)
|
|
51
|
+
expect(salesorder.item_list.items.length).to eql(1)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
it 'can be set from a SalesOrderItemList object' do
|
|
55
55
|
item_list = NetSuite::Records::SalesOrderItemList.new
|
|
56
56
|
salesorder.item_list = item_list
|
|
57
|
-
salesorder.item_list.
|
|
57
|
+
expect(salesorder.item_list).to eql(item_list)
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
@@ -93,10 +93,10 @@ describe NetSuite::Records::SalesOrder do
|
|
|
93
93
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :alt_shipping_cost => 100 }) }
|
|
94
94
|
|
|
95
95
|
it 'returns a SalesOrder instance populated with the data from the response object' do
|
|
96
|
-
NetSuite::Actions::Get.
|
|
96
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::SalesOrder, :external_id => 1], {}).and_return(response)
|
|
97
97
|
salesorder = NetSuite::Records::SalesOrder.get(:external_id => 1)
|
|
98
|
-
salesorder.
|
|
99
|
-
salesorder.alt_shipping_cost.
|
|
98
|
+
expect(salesorder).to be_kind_of(NetSuite::Records::SalesOrder)
|
|
99
|
+
expect(salesorder.alt_shipping_cost).to eql(100)
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
|
|
@@ -104,10 +104,10 @@ describe NetSuite::Records::SalesOrder do
|
|
|
104
104
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
105
105
|
|
|
106
106
|
it 'raises a RecordNotFound exception' do
|
|
107
|
-
NetSuite::Actions::Get.
|
|
108
|
-
|
|
107
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::SalesOrder, :external_id => 1], {}).and_return(response)
|
|
108
|
+
expect {
|
|
109
109
|
NetSuite::Records::SalesOrder.get(:external_id => 1)
|
|
110
|
-
}.
|
|
110
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
111
111
|
/NetSuite::Records::SalesOrder with OPTIONS=(.*) could not be found/)
|
|
112
112
|
end
|
|
113
113
|
end
|
|
@@ -116,9 +116,9 @@ describe NetSuite::Records::SalesOrder do
|
|
|
116
116
|
describe '.initialize' do
|
|
117
117
|
context 'when the request is successful' do
|
|
118
118
|
it 'returns an initialized sales order from the customer entity' do
|
|
119
|
-
NetSuite::Actions::Initialize.
|
|
119
|
+
expect(NetSuite::Actions::Initialize).to receive(:call).with([NetSuite::Records::SalesOrder, customer], {}).and_return(response)
|
|
120
120
|
salesorder = NetSuite::Records::SalesOrder.initialize(customer)
|
|
121
|
-
salesorder.
|
|
121
|
+
expect(salesorder).to be_kind_of(NetSuite::Records::SalesOrder)
|
|
122
122
|
end
|
|
123
123
|
end
|
|
124
124
|
|
|
@@ -135,10 +135,10 @@ describe NetSuite::Records::SalesOrder do
|
|
|
135
135
|
|
|
136
136
|
it 'returns true' do
|
|
137
137
|
salesorder = NetSuite::Records::SalesOrder.new(test_data)
|
|
138
|
-
NetSuite::Actions::Add.
|
|
138
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
139
139
|
with([salesorder], {}).
|
|
140
140
|
and_return(response)
|
|
141
|
-
salesorder.add.
|
|
141
|
+
expect(salesorder.add).to be_truthy
|
|
142
142
|
end
|
|
143
143
|
end
|
|
144
144
|
|
|
@@ -147,10 +147,10 @@ describe NetSuite::Records::SalesOrder do
|
|
|
147
147
|
|
|
148
148
|
it 'returns false' do
|
|
149
149
|
salesorder = NetSuite::Records::SalesOrder.new(test_data)
|
|
150
|
-
NetSuite::Actions::Add.
|
|
150
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
151
151
|
with([salesorder], {}).
|
|
152
152
|
and_return(response)
|
|
153
|
-
salesorder.add.
|
|
153
|
+
expect(salesorder.add).to be_falsey
|
|
154
154
|
end
|
|
155
155
|
end
|
|
156
156
|
end
|
|
@@ -163,10 +163,10 @@ describe NetSuite::Records::SalesOrder do
|
|
|
163
163
|
|
|
164
164
|
it 'returns true' do
|
|
165
165
|
salesorder = NetSuite::Records::SalesOrder.new(test_data)
|
|
166
|
-
NetSuite::Actions::Delete.
|
|
166
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
167
167
|
with([salesorder], {}).
|
|
168
168
|
and_return(response)
|
|
169
|
-
salesorder.delete.
|
|
169
|
+
expect(salesorder.delete).to be_truthy
|
|
170
170
|
end
|
|
171
171
|
end
|
|
172
172
|
|
|
@@ -175,10 +175,10 @@ describe NetSuite::Records::SalesOrder do
|
|
|
175
175
|
|
|
176
176
|
it 'returns false' do
|
|
177
177
|
salesorder = NetSuite::Records::SalesOrder.new(test_data)
|
|
178
|
-
NetSuite::Actions::Delete.
|
|
178
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
179
179
|
with([salesorder], {}).
|
|
180
180
|
and_return(response)
|
|
181
|
-
salesorder.delete.
|
|
181
|
+
expect(salesorder.delete).to be_falsey
|
|
182
182
|
end
|
|
183
183
|
end
|
|
184
184
|
end
|
|
@@ -193,13 +193,13 @@ describe NetSuite::Records::SalesOrder do
|
|
|
193
193
|
'tranSales:email' => 'something@example.com',
|
|
194
194
|
'tranSales:tranId' => '4'
|
|
195
195
|
}
|
|
196
|
-
salesorder.to_record.
|
|
196
|
+
expect(salesorder.to_record).to eql(record)
|
|
197
197
|
end
|
|
198
198
|
end
|
|
199
199
|
|
|
200
200
|
describe '#record_type' do
|
|
201
201
|
it 'returns a string representation of the SOAP type' do
|
|
202
|
-
salesorder.record_type.
|
|
202
|
+
expect(salesorder.record_type).to eql('tranSales:SalesOrder')
|
|
203
203
|
end
|
|
204
204
|
end
|
|
205
205
|
|