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
|
@@ -27,7 +27,7 @@ describe NetSuite::Records::InventoryItem do
|
|
|
27
27
|
:transfer_price, :upc_code, :url_component, :use_bins, :use_marginal_rates, :vendor_name, :vsoe_deferral, :vsoe_delivered,
|
|
28
28
|
:vsoe_permit_discount, :vsoe_price, :weight, :weight_unit, :weight_units
|
|
29
29
|
].each do |field|
|
|
30
|
-
item.
|
|
30
|
+
expect(item).to have_field(field)
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ describe NetSuite::Records::InventoryItem do
|
|
|
35
35
|
[
|
|
36
36
|
:alternate_demand_source_item, :asset_account, :bill_exch_rate_variance_acct, :bill_price_variance_acct, :bill_qty_variance_acct, :billing_schedule, :cogs_account, :cost_category, :custom_form, :deferred_revenue_account, :demand_source, :department, :expense_account, :gain_loss_account, :income_account, :issue_product, :klass, :location, :parent, :preferred_location, :pricing_group, :purchase_price_variance_acct, :purchase_tax_code, :purchase_unit, :quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :ship_package, :soft_descriptor, :stock_unit, :store_display_image, :store_display_thumbnail, :store_item_template, :supply_lot_sizing_method, :supply_replenishment_method, :supply_type, :tax_schedule, :units_type, :vendor
|
|
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
|
|
|
@@ -104,10 +104,10 @@ describe NetSuite::Records::InventoryItem do
|
|
|
104
104
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :cost => 100 }) }
|
|
105
105
|
|
|
106
106
|
it 'returns a InventoryItem instance populated with the data from the response object' do
|
|
107
|
-
NetSuite::Actions::Get.
|
|
107
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::InventoryItem, {:external_id => 1}], {}).and_return(response)
|
|
108
108
|
item = NetSuite::Records::InventoryItem.get(:external_id => 1)
|
|
109
|
-
item.
|
|
110
|
-
item.cost.
|
|
109
|
+
expect(item).to be_kind_of(NetSuite::Records::InventoryItem)
|
|
110
|
+
expect(item.cost).to eql(100)
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
|
|
@@ -115,10 +115,10 @@ describe NetSuite::Records::InventoryItem do
|
|
|
115
115
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
116
116
|
|
|
117
117
|
it 'raises a RecordNotFound exception' do
|
|
118
|
-
NetSuite::Actions::Get.
|
|
119
|
-
|
|
118
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::InventoryItem, {:external_id => 1}], {}).and_return(response)
|
|
119
|
+
expect {
|
|
120
120
|
NetSuite::Records::InventoryItem.get(:external_id => 1)
|
|
121
|
-
}.
|
|
121
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
122
122
|
/NetSuite::Records::InventoryItem with OPTIONS=(.*) could not be found/)
|
|
123
123
|
end
|
|
124
124
|
end
|
|
@@ -131,10 +131,10 @@ describe NetSuite::Records::InventoryItem do
|
|
|
131
131
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
|
132
132
|
|
|
133
133
|
it 'returns true' do
|
|
134
|
-
NetSuite::Actions::Add.
|
|
134
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
135
135
|
with([item], {}).
|
|
136
136
|
and_return(response)
|
|
137
|
-
item.add.
|
|
137
|
+
expect(item.add).to be_truthy
|
|
138
138
|
end
|
|
139
139
|
end
|
|
140
140
|
|
|
@@ -142,10 +142,10 @@ describe NetSuite::Records::InventoryItem do
|
|
|
142
142
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
143
143
|
|
|
144
144
|
it 'returns false' do
|
|
145
|
-
NetSuite::Actions::Add.
|
|
145
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
146
146
|
with([item], {}).
|
|
147
147
|
and_return(response)
|
|
148
|
-
item.add.
|
|
148
|
+
expect(item.add).to be_falsey
|
|
149
149
|
end
|
|
150
150
|
end
|
|
151
151
|
end
|
|
@@ -155,10 +155,10 @@ describe NetSuite::Records::InventoryItem do
|
|
|
155
155
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
|
156
156
|
|
|
157
157
|
it 'returns true' do
|
|
158
|
-
NetSuite::Actions::Delete.
|
|
158
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
159
159
|
with([item], {}).
|
|
160
160
|
and_return(response)
|
|
161
|
-
item.delete.
|
|
161
|
+
expect(item.delete).to be_truthy
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
|
|
@@ -166,10 +166,10 @@ describe NetSuite::Records::InventoryItem do
|
|
|
166
166
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
167
167
|
|
|
168
168
|
it 'returns false' do
|
|
169
|
-
NetSuite::Actions::Delete.
|
|
169
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
170
170
|
with([item], {}).
|
|
171
171
|
and_return(response)
|
|
172
|
-
item.delete.
|
|
172
|
+
expect(item.delete).to be_falsey
|
|
173
173
|
end
|
|
174
174
|
end
|
|
175
175
|
end
|
|
@@ -184,13 +184,13 @@ describe NetSuite::Records::InventoryItem do
|
|
|
184
184
|
'listAcct:cost' => 100,
|
|
185
185
|
'listAcct:isInactive' => false
|
|
186
186
|
}
|
|
187
|
-
item.to_record.
|
|
187
|
+
expect(item.to_record).to eql(record)
|
|
188
188
|
end
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
describe '#record_type' do
|
|
192
192
|
it 'returns a string representation of the SOAP type' do
|
|
193
|
-
item.record_type.
|
|
193
|
+
expect(item.record_type).to eql('listAcct:InventoryItem')
|
|
194
194
|
end
|
|
195
195
|
end
|
|
196
196
|
|
|
@@ -7,7 +7,7 @@ describe NetSuite::Records::InventoryTransfer do
|
|
|
7
7
|
[
|
|
8
8
|
:created_date, :last_modified_date, :tran_date, :tran_id, :memo
|
|
9
9
|
].each do |field|
|
|
10
|
-
inventory_transfer.
|
|
10
|
+
expect(inventory_transfer).to have_field(field)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ describe NetSuite::Records::InventoryTransfer do
|
|
|
15
15
|
[
|
|
16
16
|
:posting_period, :location, :transfer_location, :department, :subsidiary
|
|
17
17
|
].each do |record_ref|
|
|
18
|
-
inventory_transfer.
|
|
18
|
+
expect(inventory_transfer).to have_record_ref(record_ref)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -37,8 +37,8 @@ describe NetSuite::Records::InventoryTransfer do
|
|
|
37
37
|
}]
|
|
38
38
|
}
|
|
39
39
|
inventory_transfer.inventory_list = attributes
|
|
40
|
-
inventory_transfer.inventory_list.
|
|
41
|
-
inventory_transfer.inventory_list.inventory.length.
|
|
40
|
+
expect(inventory_transfer.inventory_list).to be_kind_of(NetSuite::Records::InventoryTransferInventoryList)
|
|
41
|
+
expect(inventory_transfer.inventory_list.inventory.length).to eql(1)
|
|
42
42
|
|
|
43
43
|
expect(
|
|
44
44
|
inventory_transfer.inventory_list.inventory.first.inventory_detail.inventory_assignment_list.inventory_assignment.first.quantity
|
|
@@ -52,7 +52,7 @@ describe NetSuite::Records::InventoryTransfer do
|
|
|
52
52
|
it 'can be set from a InventoryTransferInventoryList object' do
|
|
53
53
|
inventory_list = NetSuite::Records::InventoryTransferInventoryList.new
|
|
54
54
|
inventory_transfer.inventory_list = inventory_list
|
|
55
|
-
inventory_transfer.inventory_list.
|
|
55
|
+
expect(inventory_transfer.inventory_list).to eql(inventory_list)
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -7,9 +7,9 @@ describe NetSuite::Records::InvoiceItemList do
|
|
|
7
7
|
it 'can have items be added to it' do
|
|
8
8
|
list.items << item
|
|
9
9
|
item_list = list.items
|
|
10
|
-
item_list.
|
|
11
|
-
item_list.length.
|
|
12
|
-
item_list.each { |i| i.
|
|
10
|
+
expect(item_list).to be_kind_of(Array)
|
|
11
|
+
expect(item_list.length).to eql(1)
|
|
12
|
+
item_list.each { |i| expect(i).to be_kind_of(NetSuite::Records::InvoiceItem) }
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
describe '#to_record' do
|
|
@@ -17,7 +17,7 @@ describe NetSuite::Records::InvoiceItemList do
|
|
|
17
17
|
record = {
|
|
18
18
|
'tranSales:item' => []
|
|
19
19
|
}
|
|
20
|
-
list.to_record.
|
|
20
|
+
expect(list.to_record).to eql(record)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -13,7 +13,7 @@ describe NetSuite::Records::InvoiceItem do
|
|
|
13
13
|
:tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount,
|
|
14
14
|
:vsoe_price
|
|
15
15
|
].each do |field|
|
|
16
|
-
item.
|
|
16
|
+
expect(item).to have_field(field)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
@@ -22,16 +22,16 @@ describe NetSuite::Records::InvoiceItem do
|
|
|
22
22
|
:department, :item, :job, :location, :price, :rev_rec_schedule, :ship_address, :ship_method, :tax_code, :units,
|
|
23
23
|
:klass
|
|
24
24
|
].each do |record_ref|
|
|
25
|
-
item.
|
|
25
|
+
expect(item).to have_record_ref(record_ref)
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
it 'can initialize from a record' do
|
|
30
30
|
record = NetSuite::Records::InvoiceItem.new(:amount => 123, :cost_estimate => 234)
|
|
31
31
|
item = NetSuite::Records::InvoiceItem.new(record)
|
|
32
|
-
item.
|
|
33
|
-
item.amount.
|
|
34
|
-
item.cost_estimate.
|
|
32
|
+
expect(item).to be_kind_of(NetSuite::Records::InvoiceItem)
|
|
33
|
+
expect(item.amount).to eql(123)
|
|
34
|
+
expect(item.cost_estimate).to eql(234)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
describe '#custom_field_list' do
|
|
@@ -43,15 +43,15 @@ describe NetSuite::Records::InvoiceItem do
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
item.custom_field_list = attributes
|
|
46
|
-
item.custom_field_list.
|
|
47
|
-
item.custom_field_list.custom_fields.length.
|
|
48
|
-
item.custom_field_list.custfield_value.attributes[:value].
|
|
46
|
+
expect(item.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
|
|
47
|
+
expect(item.custom_field_list.custom_fields.length).to eql(1)
|
|
48
|
+
expect(item.custom_field_list.custfield_value.attributes[:value]).to eq(10)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
it 'can be set from a CustomFieldList object' do
|
|
52
52
|
custom_field_list = NetSuite::Records::CustomFieldList.new
|
|
53
53
|
item.custom_field_list = custom_field_list
|
|
54
|
-
item.custom_field_list.
|
|
54
|
+
expect(item.custom_field_list).to eql(custom_field_list)
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
|
|
@@ -66,13 +66,13 @@ describe NetSuite::Records::InvoiceItem do
|
|
|
66
66
|
'tranSales:amount' => '7',
|
|
67
67
|
'tranSales:description' => 'Some thingy'
|
|
68
68
|
}
|
|
69
|
-
item.to_record.
|
|
69
|
+
expect(item.to_record).to eql(record)
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
describe '#record_type' do
|
|
74
74
|
it 'returns a string of the SOAP record type' do
|
|
75
|
-
item.record_type.
|
|
75
|
+
expect(item.record_type).to eql('tranSales:InvoiceItem')
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
|
|
@@ -28,7 +28,7 @@ describe NetSuite::Records::Invoice do
|
|
|
28
28
|
:to_be_printed, :total_cost_estimate, :tracking_numbers, :tran_date, :tran_id, :tran_is_vsoe_bundle,
|
|
29
29
|
:vat_reg_num, :vsoe_auto_calc
|
|
30
30
|
].each do |field|
|
|
31
|
-
invoice.
|
|
31
|
+
expect(invoice).to have_field(field)
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -37,7 +37,7 @@ describe NetSuite::Records::Invoice do
|
|
|
37
37
|
:sub_total, :discount_total, :total, :alt_handling_cost, :alt_shipping_cost, :gift_cert_applied, :tax_rate,
|
|
38
38
|
:handling_cost, :recognized_revenue, :amount_remaining, :amount_paid
|
|
39
39
|
].each do |field|
|
|
40
|
-
NetSuite::Records::Invoice.
|
|
40
|
+
expect(NetSuite::Records::Invoice).to have_read_only_field(field)
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -46,7 +46,7 @@ describe NetSuite::Records::Invoice do
|
|
|
46
46
|
:account, :bill_address_list, :custom_form, :department, :entity, :klass, :posting_period, :ship_address_list, :terms,
|
|
47
47
|
:created_from, :location, :sales_rep, :ship_method, :tax_item, :partner
|
|
48
48
|
].each do |record_ref|
|
|
49
|
-
invoice.
|
|
49
|
+
expect(invoice).to have_record_ref(record_ref)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -59,14 +59,14 @@ describe NetSuite::Records::Invoice do
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
invoice.custom_field_list = attributes
|
|
62
|
-
invoice.custom_field_list.
|
|
63
|
-
invoice.custom_field_list.custom_fields.length.
|
|
62
|
+
expect(invoice.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
|
|
63
|
+
expect(invoice.custom_field_list.custom_fields.length).to eql(1)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
it 'can be set from a CustomFieldList object' do
|
|
67
67
|
custom_field_list = NetSuite::Records::CustomFieldList.new
|
|
68
68
|
invoice.custom_field_list = custom_field_list
|
|
69
|
-
invoice.custom_field_list.
|
|
69
|
+
expect(invoice.custom_field_list).to eql(custom_field_list)
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -78,14 +78,14 @@ describe NetSuite::Records::Invoice do
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
invoice.item_list = attributes
|
|
81
|
-
invoice.item_list.
|
|
82
|
-
invoice.item_list.items.length.
|
|
81
|
+
expect(invoice.item_list).to be_kind_of(NetSuite::Records::InvoiceItemList)
|
|
82
|
+
expect(invoice.item_list.items.length).to eql(1)
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
it 'can be set from a CustomFieldList object' do
|
|
86
86
|
item_list = NetSuite::Records::InvoiceItemList.new
|
|
87
87
|
invoice.item_list = item_list
|
|
88
|
-
invoice.item_list.
|
|
88
|
+
expect(invoice.item_list).to eql(item_list)
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
91
|
|
|
@@ -99,14 +99,14 @@ describe NetSuite::Records::Invoice do
|
|
|
99
99
|
:bill_state => 'CA',
|
|
100
100
|
:bill_zip => '90007'
|
|
101
101
|
}
|
|
102
|
-
invoice.transaction_bill_address.
|
|
103
|
-
invoice.transaction_bill_address.bill_city.
|
|
102
|
+
expect(invoice.transaction_bill_address).to be_kind_of(NetSuite::Records::BillAddress)
|
|
103
|
+
expect(invoice.transaction_bill_address.bill_city).to eql('Los Angeles')
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
it 'can be set with a BillAddress object' do
|
|
107
107
|
bill_address = NetSuite::Records::BillAddress.new
|
|
108
108
|
invoice.transaction_bill_address = bill_address
|
|
109
|
-
invoice.transaction_bill_address.
|
|
109
|
+
expect(invoice.transaction_bill_address).to eql(bill_address)
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
|
|
@@ -121,14 +121,14 @@ describe NetSuite::Records::Invoice do
|
|
|
121
121
|
:ship_state => 'CA',
|
|
122
122
|
:ship_zip => '90007'
|
|
123
123
|
}
|
|
124
|
-
invoice.transaction_ship_address.
|
|
125
|
-
invoice.transaction_ship_address.ship_addr1.
|
|
124
|
+
expect(invoice.transaction_ship_address).to be_kind_of(NetSuite::Records::ShipAddress)
|
|
125
|
+
expect(invoice.transaction_ship_address.ship_addr1).to eql('123 Happy Lane')
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
it 'can be set with a ShipAddress object' do
|
|
129
129
|
ship_address = NetSuite::Records::ShipAddress.new
|
|
130
130
|
invoice.transaction_ship_address = ship_address
|
|
131
|
-
invoice.transaction_ship_address.
|
|
131
|
+
expect(invoice.transaction_ship_address).to eql(ship_address)
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
|
|
@@ -137,9 +137,9 @@ describe NetSuite::Records::Invoice do
|
|
|
137
137
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :is_person => true }) }
|
|
138
138
|
|
|
139
139
|
it 'returns an Invoice instance populated with the data from the response object' do
|
|
140
|
-
NetSuite::Actions::Get.
|
|
140
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Invoice, {:external_id => 10}], {}).and_return(response)
|
|
141
141
|
invoice = NetSuite::Records::Invoice.get(:external_id => 10)
|
|
142
|
-
invoice.
|
|
142
|
+
expect(invoice).to be_kind_of(NetSuite::Records::Invoice)
|
|
143
143
|
end
|
|
144
144
|
end
|
|
145
145
|
|
|
@@ -147,10 +147,10 @@ describe NetSuite::Records::Invoice do
|
|
|
147
147
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
148
148
|
|
|
149
149
|
it 'raises a RecordNotFound exception' do
|
|
150
|
-
NetSuite::Actions::Get.
|
|
151
|
-
|
|
150
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Invoice, {:external_id => 10}], {}).and_return(response)
|
|
151
|
+
expect {
|
|
152
152
|
NetSuite::Records::Invoice.get(:external_id => 10)
|
|
153
|
-
}.
|
|
153
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
154
154
|
/NetSuite::Records::Invoice with OPTIONS=(.*) could not be found/)
|
|
155
155
|
end
|
|
156
156
|
end
|
|
@@ -159,9 +159,9 @@ describe NetSuite::Records::Invoice do
|
|
|
159
159
|
describe '.initialize' do
|
|
160
160
|
context 'when the request is successful' do
|
|
161
161
|
it 'returns an initialized invoice from the customer entity' do
|
|
162
|
-
NetSuite::Actions::Initialize.
|
|
162
|
+
expect(NetSuite::Actions::Initialize).to receive(:call).with([NetSuite::Records::Invoice, customer], {}).and_return(response)
|
|
163
163
|
invoice = NetSuite::Records::Invoice.initialize(customer)
|
|
164
|
-
invoice.
|
|
164
|
+
expect(invoice).to be_kind_of(NetSuite::Records::Invoice)
|
|
165
165
|
end
|
|
166
166
|
end
|
|
167
167
|
|
|
@@ -178,10 +178,10 @@ describe NetSuite::Records::Invoice do
|
|
|
178
178
|
|
|
179
179
|
it 'returns true' do
|
|
180
180
|
invoice = NetSuite::Records::Invoice.new(test_data)
|
|
181
|
-
NetSuite::Actions::Add.
|
|
181
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
182
182
|
with([invoice], {}).
|
|
183
183
|
and_return(response)
|
|
184
|
-
invoice.add.
|
|
184
|
+
expect(invoice.add).to be_truthy
|
|
185
185
|
end
|
|
186
186
|
end
|
|
187
187
|
|
|
@@ -190,10 +190,10 @@ describe NetSuite::Records::Invoice do
|
|
|
190
190
|
|
|
191
191
|
it 'returns false' do
|
|
192
192
|
invoice = NetSuite::Records::Invoice.new(test_data)
|
|
193
|
-
NetSuite::Actions::Add.
|
|
193
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
194
194
|
with([invoice], {}).
|
|
195
195
|
and_return(response)
|
|
196
|
-
invoice.add.
|
|
196
|
+
expect(invoice.add).to be_falsey
|
|
197
197
|
end
|
|
198
198
|
end
|
|
199
199
|
end
|
|
@@ -204,10 +204,10 @@ describe NetSuite::Records::Invoice do
|
|
|
204
204
|
|
|
205
205
|
it 'returns true' do
|
|
206
206
|
invoice = NetSuite::Records::Invoice.new
|
|
207
|
-
NetSuite::Actions::Delete.
|
|
207
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
208
208
|
with([invoice], {}).
|
|
209
209
|
and_return(response)
|
|
210
|
-
invoice.delete.
|
|
210
|
+
expect(invoice.delete).to be_truthy
|
|
211
211
|
end
|
|
212
212
|
end
|
|
213
213
|
|
|
@@ -216,10 +216,10 @@ describe NetSuite::Records::Invoice do
|
|
|
216
216
|
|
|
217
217
|
it 'returns false' do
|
|
218
218
|
invoice = NetSuite::Records::Invoice.new
|
|
219
|
-
NetSuite::Actions::Delete.
|
|
219
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
220
220
|
with([invoice], {}).
|
|
221
221
|
and_return(response)
|
|
222
|
-
invoice.delete.
|
|
222
|
+
expect(invoice.delete).to be_falsey
|
|
223
223
|
end
|
|
224
224
|
end
|
|
225
225
|
end
|
|
@@ -234,13 +234,13 @@ describe NetSuite::Records::Invoice do
|
|
|
234
234
|
'tranSales:email' => 'something@example.com',
|
|
235
235
|
'tranSales:tranId' => '4'
|
|
236
236
|
}
|
|
237
|
-
invoice.to_record.
|
|
237
|
+
expect(invoice.to_record).to eql(record)
|
|
238
238
|
end
|
|
239
239
|
end
|
|
240
240
|
|
|
241
241
|
describe '#record_type' do
|
|
242
242
|
it 'returns a string representation of the SOAP type' do
|
|
243
|
-
invoice.record_type.
|
|
243
|
+
expect(invoice.record_type).to eql('tranSales:Invoice')
|
|
244
244
|
end
|
|
245
245
|
end
|
|
246
246
|
|
|
@@ -4,7 +4,7 @@ describe NetSuite::Records::ItemFulfillmentPackageList do
|
|
|
4
4
|
let(:list) { NetSuite::Records::ItemFulfillmentPackageList.new }
|
|
5
5
|
|
|
6
6
|
it 'has a packages attribute' do
|
|
7
|
-
list.packages.
|
|
7
|
+
expect(list.packages).to be_kind_of(Array)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe '#to_record' do
|
|
@@ -21,7 +21,7 @@ describe NetSuite::Records::ItemFulfillmentPackageList do
|
|
|
21
21
|
]
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
list.to_record.
|
|
24
|
+
expect(list.to_record).to eql(record)
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
end
|