netsuite 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -22,7 +22,7 @@ describe NetSuite::Records::Customer do
|
|
22
22
|
:territory, :third_party_acct, :third_party_country, :third_party_zipcode, :title, :unbilled_orders, :url,
|
23
23
|
:vat_reg_number, :visits, :web_lead
|
24
24
|
].each do |field|
|
25
|
-
customer.
|
25
|
+
expect(customer).to have_field(field)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,7 @@ describe NetSuite::Records::Customer do
|
|
30
30
|
[
|
31
31
|
:custom_form, :entity_status, :partner
|
32
32
|
].each do |record_ref|
|
33
|
-
customer.
|
33
|
+
expect(customer).to have_record_ref(record_ref)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -54,14 +54,14 @@ describe NetSuite::Records::Customer do
|
|
54
54
|
:zip => '90007'
|
55
55
|
}
|
56
56
|
}
|
57
|
-
customer.addressbook_list.
|
58
|
-
customer.addressbook_list.addressbooks.length.
|
57
|
+
expect(customer.addressbook_list).to be_kind_of(NetSuite::Records::CustomerAddressbookList)
|
58
|
+
expect(customer.addressbook_list.addressbooks.length).to eql(1)
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'can be set from a CustomerAddressbookList object' do
|
62
62
|
customer_addressbook_list = NetSuite::Records::CustomerAddressbookList.new
|
63
63
|
customer.addressbook_list = customer_addressbook_list
|
64
|
-
customer.addressbook_list.
|
64
|
+
expect(customer.addressbook_list).to eql(customer_addressbook_list)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -74,14 +74,14 @@ describe NetSuite::Records::Customer do
|
|
74
74
|
}
|
75
75
|
}
|
76
76
|
customer.custom_field_list = attributes
|
77
|
-
customer.custom_field_list.
|
78
|
-
customer.custom_field_list.custom_fields.length.
|
77
|
+
expect(customer.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
|
78
|
+
expect(customer.custom_field_list.custom_fields.length).to eql(1)
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'can be set from a CustomFieldList object' do
|
82
82
|
custom_field_list = NetSuite::Records::CustomFieldList.new
|
83
83
|
customer.custom_field_list = custom_field_list
|
84
|
-
customer.custom_field_list.
|
84
|
+
expect(customer.custom_field_list).to eql(custom_field_list)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -90,10 +90,10 @@ describe NetSuite::Records::Customer do
|
|
90
90
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :is_person => true }) }
|
91
91
|
|
92
92
|
it 'returns a Customer instance populated with the data from the response object' do
|
93
|
-
NetSuite::Actions::Get.
|
93
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Customer, {:external_id => 1}], {}).and_return(response)
|
94
94
|
customer = NetSuite::Records::Customer.get(:external_id => 1)
|
95
|
-
customer.
|
96
|
-
customer.is_person.
|
95
|
+
expect(customer).to be_kind_of(NetSuite::Records::Customer)
|
96
|
+
expect(customer.is_person).to be_truthy
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -101,10 +101,10 @@ describe NetSuite::Records::Customer do
|
|
101
101
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
102
102
|
|
103
103
|
it 'raises a RecordNotFound exception' do
|
104
|
-
NetSuite::Actions::Get.
|
105
|
-
|
104
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Customer, {:external_id => 1}], {}).and_return(response)
|
105
|
+
expect {
|
106
106
|
NetSuite::Records::Customer.get(:external_id => 1)
|
107
|
-
}.
|
107
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
108
108
|
/NetSuite::Records::Customer with OPTIONS=(.*) could not be found/)
|
109
109
|
end
|
110
110
|
end
|
@@ -117,10 +117,10 @@ describe NetSuite::Records::Customer do
|
|
117
117
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
118
118
|
|
119
119
|
it 'returns true' do
|
120
|
-
NetSuite::Actions::Add.
|
120
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
121
121
|
with([customer], {}).
|
122
122
|
and_return(response)
|
123
|
-
customer.add.
|
123
|
+
expect(customer.add).to be_truthy
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -128,10 +128,10 @@ describe NetSuite::Records::Customer do
|
|
128
128
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
129
129
|
|
130
130
|
it 'returns false' do
|
131
|
-
NetSuite::Actions::Add.
|
131
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
132
132
|
with([customer], {}).
|
133
133
|
and_return(response)
|
134
|
-
customer.add.
|
134
|
+
expect(customer.add).to be_falsey
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
@@ -141,10 +141,10 @@ describe NetSuite::Records::Customer do
|
|
141
141
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
142
142
|
|
143
143
|
it 'returns true' do
|
144
|
-
NetSuite::Actions::Delete.
|
144
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
145
145
|
with([customer], {}).
|
146
146
|
and_return(response)
|
147
|
-
customer.delete.
|
147
|
+
expect(customer.delete).to be_truthy
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -152,10 +152,10 @@ describe NetSuite::Records::Customer do
|
|
152
152
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
153
153
|
|
154
154
|
it 'returns false' do
|
155
|
-
NetSuite::Actions::Delete.
|
155
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
156
156
|
with([customer], {}).
|
157
157
|
and_return(response)
|
158
|
-
customer.delete.
|
158
|
+
expect(customer.delete).to be_falsey
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
@@ -164,7 +164,7 @@ describe NetSuite::Records::Customer do
|
|
164
164
|
let(:customer) { NetSuite::Records::Customer.new(:entity_id => 'TEST CUSTOMER', :is_person => true) }
|
165
165
|
|
166
166
|
it 'returns a hash of attributes that can be used in a SOAP request' do
|
167
|
-
customer.to_record.
|
167
|
+
expect(customer.to_record).to eql({
|
168
168
|
'listRel:entityId' => 'TEST CUSTOMER',
|
169
169
|
'listRel:isPerson' => true
|
170
170
|
})
|
@@ -173,7 +173,7 @@ describe NetSuite::Records::Customer do
|
|
173
173
|
|
174
174
|
describe '#record_type' do
|
175
175
|
it 'returns a string type for the record to be used in a SOAP request' do
|
176
|
-
customer.record_type.
|
176
|
+
expect(customer.record_type).to eql('listRel:Customer')
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
@@ -7,7 +7,7 @@ describe NetSuite::Records::Department do
|
|
7
7
|
[
|
8
8
|
:name, :is_inactive
|
9
9
|
].each do |field|
|
10
|
-
department.
|
10
|
+
expect(department).to have_field(field)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -15,7 +15,7 @@ describe NetSuite::Records::Department do
|
|
15
15
|
[
|
16
16
|
:parent
|
17
17
|
].each do |record_ref|
|
18
|
-
department.
|
18
|
+
expect(department).to have_record_ref(record_ref)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -24,10 +24,10 @@ describe NetSuite::Records::Department do
|
|
24
24
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :name => 'Department 1' }) }
|
25
25
|
|
26
26
|
it 'returns a Department instance populated with the data from the response object' do
|
27
|
-
NetSuite::Actions::Get.
|
27
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Department, {:external_id => 1}], {}).and_return(response)
|
28
28
|
department = NetSuite::Records::Department.get(:external_id => 1)
|
29
|
-
department.
|
30
|
-
department.name.
|
29
|
+
expect(department).to be_kind_of(NetSuite::Records::Department)
|
30
|
+
expect(department.name).to eql('Department 1')
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -35,10 +35,10 @@ describe NetSuite::Records::Department do
|
|
35
35
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
36
36
|
|
37
37
|
it 'raises a RecordNotFound exception' do
|
38
|
-
NetSuite::Actions::Get.
|
39
|
-
|
38
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Department, {:external_id => 1}], {}).and_return(response)
|
39
|
+
expect {
|
40
40
|
NetSuite::Records::Department.get(:external_id => 1)
|
41
|
-
}.
|
41
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
42
42
|
/NetSuite::Records::Department with OPTIONS=(.*) could not be found/)
|
43
43
|
end
|
44
44
|
end
|
@@ -52,10 +52,10 @@ describe NetSuite::Records::Department do
|
|
52
52
|
|
53
53
|
it 'returns true' do
|
54
54
|
department = NetSuite::Records::Department.new(test_data)
|
55
|
-
NetSuite::Actions::Add.
|
55
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
56
56
|
with([department], {}).
|
57
57
|
and_return(response)
|
58
|
-
department.add.
|
58
|
+
expect(department.add).to be_truthy
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -64,10 +64,10 @@ describe NetSuite::Records::Department do
|
|
64
64
|
|
65
65
|
it 'returns false' do
|
66
66
|
department = NetSuite::Records::Department.new(test_data)
|
67
|
-
NetSuite::Actions::Add.
|
67
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
68
68
|
with([department], {}).
|
69
69
|
and_return(response)
|
70
|
-
department.add.
|
70
|
+
expect(department.add).to be_falsey
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -80,10 +80,10 @@ describe NetSuite::Records::Department do
|
|
80
80
|
|
81
81
|
it 'returns true' do
|
82
82
|
department = NetSuite::Records::Department.new(test_data)
|
83
|
-
NetSuite::Actions::Delete.
|
83
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
84
84
|
with([department], {}).
|
85
85
|
and_return(response)
|
86
|
-
department.delete.
|
86
|
+
expect(department.delete).to be_truthy
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -92,10 +92,10 @@ describe NetSuite::Records::Department do
|
|
92
92
|
|
93
93
|
it 'returns false' do
|
94
94
|
department = NetSuite::Records::Department.new(test_data)
|
95
|
-
NetSuite::Actions::Delete.
|
95
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
96
96
|
with([department], {}).
|
97
97
|
and_return(response)
|
98
|
-
department.delete.
|
98
|
+
expect(department.delete).to be_falsey
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
@@ -9,7 +9,7 @@ describe NetSuite::Records::Deposit do
|
|
9
9
|
[
|
10
10
|
:created_date, :last_modified_date, :currency_name, :tran_id, :total, :tran_date, :memo, :to_be_printed
|
11
11
|
].each do |field|
|
12
|
-
deposit.
|
12
|
+
expect(deposit).to have_field(field)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -17,7 +17,7 @@ describe NetSuite::Records::Deposit do
|
|
17
17
|
[
|
18
18
|
:custom_form, :account, :posting_period, :subsidiary, :department, :klass, :location
|
19
19
|
].each do |record_ref|
|
20
|
-
deposit.
|
20
|
+
expect(deposit).to have_record_ref(record_ref)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -31,14 +31,14 @@ describe NetSuite::Records::Deposit do
|
|
31
31
|
}
|
32
32
|
}
|
33
33
|
deposit.payment_list.payment = attributes
|
34
|
-
deposit.payment_list.
|
35
|
-
deposit.payment_list.payments.length.
|
34
|
+
expect(deposit.payment_list).to be_kind_of(NetSuite::Records::DepositPaymentList)
|
35
|
+
expect(deposit.payment_list.payments.length).to eql(1)
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'can be set from a DepositItemList object' do
|
39
39
|
item_list = NetSuite::Records::DepositPaymentList.new
|
40
40
|
deposit.payment_list = item_list
|
41
|
-
deposit.payment_list.
|
41
|
+
expect(deposit.payment_list).to eql(item_list)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -49,14 +49,14 @@ describe NetSuite::Records::Deposit do
|
|
49
49
|
memo: "test"
|
50
50
|
}
|
51
51
|
deposit.cash_back_list.cashback = attributes
|
52
|
-
deposit.cash_back_list.
|
53
|
-
deposit.cash_back_list.cashbacks.length.
|
52
|
+
expect(deposit.cash_back_list).to be_kind_of(NetSuite::Records::DepositCashBackList)
|
53
|
+
expect(deposit.cash_back_list.cashbacks.length).to eql(1)
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'can be set from a DepositCashBackList object' do
|
57
57
|
item_list = NetSuite::Records::DepositCashBackList.new
|
58
58
|
deposit.cash_back_list = item_list
|
59
|
-
deposit.cash_back_list.
|
59
|
+
expect(deposit.cash_back_list).to eql(item_list)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -65,10 +65,10 @@ describe NetSuite::Records::Deposit do
|
|
65
65
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :memo => 'transfer for subscriptions' }) }
|
66
66
|
|
67
67
|
it 'returns a Deposit instance populated with the data from the response object' do
|
68
|
-
NetSuite::Actions::Get.
|
68
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Deposit, {:external_id => 1}], {}).and_return(response)
|
69
69
|
deposit = NetSuite::Records::Deposit.get(:external_id => 1)
|
70
|
-
deposit.
|
71
|
-
deposit.memo.
|
70
|
+
expect(deposit).to be_kind_of(NetSuite::Records::Deposit)
|
71
|
+
expect(deposit.memo).to eql('transfer for subscriptions')
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -76,10 +76,10 @@ describe NetSuite::Records::Deposit do
|
|
76
76
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
77
77
|
|
78
78
|
it 'raises a RecordNotFound exception' do
|
79
|
-
NetSuite::Actions::Get.
|
80
|
-
|
79
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Deposit, {:external_id => 1}], {}).and_return(response)
|
80
|
+
expect {
|
81
81
|
NetSuite::Records::Deposit.get(:external_id => 1)
|
82
|
-
}.
|
82
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
83
83
|
/NetSuite::Records::Deposit with OPTIONS=(.*) could not be found/)
|
84
84
|
end
|
85
85
|
end
|
@@ -93,10 +93,10 @@ describe NetSuite::Records::Deposit do
|
|
93
93
|
|
94
94
|
it 'returns true' do
|
95
95
|
deposit = NetSuite::Records::Deposit.new(test_data)
|
96
|
-
NetSuite::Actions::Add.
|
96
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
97
97
|
with([deposit], {}).
|
98
98
|
and_return(response)
|
99
|
-
deposit.add.
|
99
|
+
expect(deposit.add).to be_truthy
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
@@ -105,10 +105,10 @@ describe NetSuite::Records::Deposit do
|
|
105
105
|
|
106
106
|
it 'returns false' do
|
107
107
|
deposit = NetSuite::Records::Deposit.new(test_data)
|
108
|
-
NetSuite::Actions::Add.
|
108
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
109
109
|
with([deposit], {}).
|
110
110
|
and_return(response)
|
111
|
-
deposit.add.
|
111
|
+
expect(deposit.add).to be_falsey
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -121,10 +121,10 @@ describe NetSuite::Records::Deposit do
|
|
121
121
|
|
122
122
|
it 'returns true' do
|
123
123
|
deposit = NetSuite::Records::Deposit.new(test_data)
|
124
|
-
NetSuite::Actions::Delete.
|
124
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
125
125
|
with([deposit], {}).
|
126
126
|
and_return(response)
|
127
|
-
deposit.delete.
|
127
|
+
expect(deposit.delete).to be_truthy
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
@@ -133,10 +133,10 @@ describe NetSuite::Records::Deposit do
|
|
133
133
|
|
134
134
|
it 'returns false' do
|
135
135
|
deposit = NetSuite::Records::Deposit.new(test_data)
|
136
|
-
NetSuite::Actions::Delete.
|
136
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
137
137
|
with([deposit], {}).
|
138
138
|
and_return(response)
|
139
|
-
deposit.delete.
|
139
|
+
expect(deposit.delete).to be_falsey
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
@@ -151,13 +151,13 @@ describe NetSuite::Records::Deposit do
|
|
151
151
|
'tranBank:memo' => 'something@example.com',
|
152
152
|
'tranBank:tranId' => '4'
|
153
153
|
}
|
154
|
-
deposit.to_record.
|
154
|
+
expect(deposit.to_record).to eql(record)
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
158
|
describe '#record_type' do
|
159
159
|
it 'returns a string representation of the SOAP type' do
|
160
|
-
deposit.record_type.
|
160
|
+
expect(deposit.record_type).to eql('tranBank:Deposit')
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
@@ -8,11 +8,11 @@ describe NetSuite::Records::DiscountItem do
|
|
8
8
|
:available_to_partners, :created_date, :description, :display_name, :include_children, :is_inactive, :is_pretax,
|
9
9
|
:item_id, :last_modified_date, :non_posting, :rate, :upc_code, :vendor_name
|
10
10
|
].each do |field|
|
11
|
-
item.
|
11
|
+
expect(item).to have_field(field)
|
12
12
|
end
|
13
13
|
|
14
14
|
# TODO there is a probably a more robust way to test this
|
15
|
-
item.custom_field_list.class.
|
15
|
+
expect(item.custom_field_list.class).to eq(NetSuite::Records::CustomFieldList)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'has the right record_refs' do
|
@@ -21,7 +21,7 @@ describe NetSuite::Records::DiscountItem do
|
|
21
21
|
:income_account, :issue_product, :klass, :location, :parent, :rev_rec_schedule, :sales_tax_code,
|
22
22
|
:subsidiary_list, :tax_schedule
|
23
23
|
].each do |record_ref|
|
24
|
-
item.
|
24
|
+
expect(item).to have_record_ref(record_ref)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -30,10 +30,10 @@ describe NetSuite::Records::DiscountItem do
|
|
30
30
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :item_id => 'penguins' }) }
|
31
31
|
|
32
32
|
it 'returns a DiscountItem 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::DiscountItem, :external_id => 20], {}).and_return(response)
|
34
34
|
customer = NetSuite::Records::DiscountItem.get(:external_id => 20)
|
35
|
-
customer.
|
36
|
-
customer.item_id.
|
35
|
+
expect(customer).to be_kind_of(NetSuite::Records::DiscountItem)
|
36
|
+
expect(customer.item_id).to eql('penguins')
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -41,10 +41,10 @@ describe NetSuite::Records::DiscountItem 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::DiscountItem, :external_id => 20], {}).and_return(response)
|
45
|
+
expect {
|
46
46
|
NetSuite::Records::DiscountItem.get(:external_id => 20)
|
47
|
-
}.
|
47
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
48
48
|
/NetSuite::Records::DiscountItem with OPTIONS=(.*) could not be found/)
|
49
49
|
end
|
50
50
|
end
|
@@ -57,10 +57,10 @@ describe NetSuite::Records::DiscountItem do
|
|
57
57
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
58
58
|
|
59
59
|
it 'returns true' do
|
60
|
-
NetSuite::Actions::Add.
|
60
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
61
61
|
with([item], {}).
|
62
62
|
and_return(response)
|
63
|
-
item.add.
|
63
|
+
expect(item.add).to be_truthy
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -68,10 +68,10 @@ describe NetSuite::Records::DiscountItem do
|
|
68
68
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
69
69
|
|
70
70
|
it 'returns false' do
|
71
|
-
NetSuite::Actions::Add.
|
71
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
72
72
|
with([item], {}).
|
73
73
|
and_return(response)
|
74
|
-
item.add.
|
74
|
+
expect(item.add).to be_falsey
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -81,10 +81,10 @@ describe NetSuite::Records::DiscountItem do
|
|
81
81
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
82
82
|
|
83
83
|
it 'returns true' do
|
84
|
-
NetSuite::Actions::Delete.
|
84
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
85
85
|
with([item], {}).
|
86
86
|
and_return(response)
|
87
|
-
item.delete.
|
87
|
+
expect(item.delete).to be_truthy
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -92,10 +92,10 @@ describe NetSuite::Records::DiscountItem do
|
|
92
92
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
93
93
|
|
94
94
|
it 'returns false' do
|
95
|
-
NetSuite::Actions::Delete.
|
95
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
96
96
|
with([item], {}).
|
97
97
|
and_return(response)
|
98
|
-
item.delete.
|
98
|
+
expect(item.delete).to be_falsey
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
@@ -111,13 +111,13 @@ describe NetSuite::Records::DiscountItem do
|
|
111
111
|
'listAcct:itemId' => 'penguins',
|
112
112
|
'listAcct:isInactive' => true
|
113
113
|
}
|
114
|
-
item.to_record.
|
114
|
+
expect(item.to_record).to eql(record)
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
118
|
describe '#record_type' do
|
119
119
|
it 'returns a string of the SOAP type' do
|
120
|
-
item.record_type.
|
120
|
+
expect(item.record_type).to eql('listAcct:DiscountItem')
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|