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
|
@@ -15,7 +15,7 @@ describe NetSuite::Records::Job do
|
|
|
15
15
|
:opening_balance_date, :percent_complete, :percent_time_complete, :phone, :phonetic_name, :projected_end_date,
|
|
16
16
|
:projected_end_date_baseline, :start_date, :start_date_baseline
|
|
17
17
|
].each do |field|
|
|
18
|
-
job.
|
|
18
|
+
expect(job).to have_field(field)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ describe NetSuite::Records::Job do
|
|
|
23
23
|
[
|
|
24
24
|
:billing_schedule, :category, :currency, :custom_form, :entity_status, :estimate_rev_rec_template, :job_item, :job_type, :language, :parent, :subsidiary, :workplace
|
|
25
25
|
].each do |record_ref|
|
|
26
|
-
job.
|
|
26
|
+
expect(job).to have_record_ref(record_ref)
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -33,14 +33,14 @@ describe NetSuite::Records::Job do
|
|
|
33
33
|
:time_span => 10
|
|
34
34
|
}
|
|
35
35
|
job.estimated_time_override = attributes
|
|
36
|
-
job.estimated_time_override.
|
|
37
|
-
job.estimated_time_override.time_span.
|
|
36
|
+
expect(job.estimated_time_override).to be_kind_of(NetSuite::Records::Duration)
|
|
37
|
+
expect(job.estimated_time_override.time_span).to eql(10)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it 'can be set from a Duration object' do
|
|
41
41
|
duration = NetSuite::Records::Duration.new
|
|
42
42
|
job.estimated_time_override = duration
|
|
43
|
-
job.estimated_time_override.
|
|
43
|
+
expect(job.estimated_time_override).to eql(duration)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -50,14 +50,14 @@ describe NetSuite::Records::Job do
|
|
|
50
50
|
:time_span => 20
|
|
51
51
|
}
|
|
52
52
|
job.actual_time = attributes
|
|
53
|
-
job.actual_time.
|
|
54
|
-
job.actual_time.time_span.
|
|
53
|
+
expect(job.actual_time).to be_kind_of(NetSuite::Records::Duration)
|
|
54
|
+
expect(job.actual_time.time_span).to eql(20)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
it 'can be set from a Duration object' do
|
|
58
58
|
duration = NetSuite::Records::Duration.new
|
|
59
59
|
job.actual_time = duration
|
|
60
|
-
job.actual_time.
|
|
60
|
+
expect(job.actual_time).to eql(duration)
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -67,14 +67,14 @@ describe NetSuite::Records::Job do
|
|
|
67
67
|
:time_span => 30
|
|
68
68
|
}
|
|
69
69
|
job.time_remaining = attributes
|
|
70
|
-
job.time_remaining.
|
|
71
|
-
job.time_remaining.time_span.
|
|
70
|
+
expect(job.time_remaining).to be_kind_of(NetSuite::Records::Duration)
|
|
71
|
+
expect(job.time_remaining.time_span).to eql(30)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
it 'can be set from a Duration object' do
|
|
75
75
|
duration = NetSuite::Records::Duration.new
|
|
76
76
|
job.time_remaining = duration
|
|
77
|
-
job.time_remaining.
|
|
77
|
+
expect(job.time_remaining).to eql(duration)
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
|
|
@@ -108,10 +108,10 @@ describe NetSuite::Records::Job do
|
|
|
108
108
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :account_number => 7 }) }
|
|
109
109
|
|
|
110
110
|
it 'returns a Job instance populated with the data from the response object' do
|
|
111
|
-
NetSuite::Actions::Get.
|
|
111
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Job, {:external_id => 1}], {}).and_return(response)
|
|
112
112
|
job = NetSuite::Records::Job.get(:external_id => 1)
|
|
113
|
-
job.
|
|
114
|
-
job.account_number.
|
|
113
|
+
expect(job).to be_kind_of(NetSuite::Records::Job)
|
|
114
|
+
expect(job.account_number).to be_truthy
|
|
115
115
|
end
|
|
116
116
|
end
|
|
117
117
|
|
|
@@ -119,10 +119,10 @@ describe NetSuite::Records::Job do
|
|
|
119
119
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
120
120
|
|
|
121
121
|
it 'raises a RecordNotFound exception' do
|
|
122
|
-
NetSuite::Actions::Get.
|
|
123
|
-
|
|
122
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Job, {:external_id => 1}], {}).and_return(response)
|
|
123
|
+
expect {
|
|
124
124
|
NetSuite::Records::Job.get(:external_id => 1)
|
|
125
|
-
}.
|
|
125
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
126
126
|
/NetSuite::Records::Job with OPTIONS=(.*) could not be found/)
|
|
127
127
|
end
|
|
128
128
|
end
|
|
@@ -135,10 +135,10 @@ describe NetSuite::Records::Job do
|
|
|
135
135
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
|
136
136
|
|
|
137
137
|
it 'returns true' do
|
|
138
|
-
NetSuite::Actions::Add.
|
|
138
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
139
139
|
with([job], {}).
|
|
140
140
|
and_return(response)
|
|
141
|
-
job.add.
|
|
141
|
+
expect(job.add).to be_truthy
|
|
142
142
|
end
|
|
143
143
|
end
|
|
144
144
|
|
|
@@ -146,10 +146,10 @@ describe NetSuite::Records::Job do
|
|
|
146
146
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
147
147
|
|
|
148
148
|
it 'returns false' do
|
|
149
|
-
NetSuite::Actions::Add.
|
|
149
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
150
150
|
with([job], {}).
|
|
151
151
|
and_return(response)
|
|
152
|
-
job.add.
|
|
152
|
+
expect(job.add).to be_falsey
|
|
153
153
|
end
|
|
154
154
|
end
|
|
155
155
|
end
|
|
@@ -159,10 +159,10 @@ describe NetSuite::Records::Job do
|
|
|
159
159
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
|
160
160
|
|
|
161
161
|
it 'returns true' do
|
|
162
|
-
NetSuite::Actions::Delete.
|
|
162
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
163
163
|
with([job], {}).
|
|
164
164
|
and_return(response)
|
|
165
|
-
job.delete.
|
|
165
|
+
expect(job.delete).to be_truthy
|
|
166
166
|
end
|
|
167
167
|
end
|
|
168
168
|
|
|
@@ -170,10 +170,10 @@ describe NetSuite::Records::Job do
|
|
|
170
170
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
171
171
|
|
|
172
172
|
it 'returns false' do
|
|
173
|
-
NetSuite::Actions::Delete.
|
|
173
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
174
174
|
with([job], {}).
|
|
175
175
|
and_return(response)
|
|
176
|
-
job.delete.
|
|
176
|
+
expect(job.delete).to be_falsey
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
179
|
end
|
|
@@ -183,9 +183,9 @@ describe NetSuite::Records::Job do
|
|
|
183
183
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :account_number => 7 }) }
|
|
184
184
|
|
|
185
185
|
it 'returns true' do
|
|
186
|
-
NetSuite::Actions::Update.
|
|
186
|
+
expect(NetSuite::Actions::Update).to receive(:call).with([NetSuite::Records::Job, {:external_id => 1, :account_number => 7}], {}).and_return(response)
|
|
187
187
|
job = NetSuite::Records::Job.new(:external_id => 1)
|
|
188
|
-
job.update(:account_number => 7).
|
|
188
|
+
expect(job.update(:account_number => 7)).to be_truthy
|
|
189
189
|
end
|
|
190
190
|
end
|
|
191
191
|
|
|
@@ -193,9 +193,9 @@ describe NetSuite::Records::Job do
|
|
|
193
193
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
194
194
|
|
|
195
195
|
it 'raises a RecordNotFound exception' do
|
|
196
|
-
NetSuite::Actions::Update.
|
|
196
|
+
expect(NetSuite::Actions::Update).to receive(:call).with([NetSuite::Records::Job, {:internal_id => 1, :account_number => 7}], {}).and_return(response)
|
|
197
197
|
job = NetSuite::Records::Job.new(:internal_id => 1)
|
|
198
|
-
job.update(:account_number => 7).
|
|
198
|
+
expect(job.update(:account_number => 7)).to be_falsey
|
|
199
199
|
end
|
|
200
200
|
end
|
|
201
201
|
end
|
|
@@ -204,7 +204,7 @@ describe NetSuite::Records::Job do
|
|
|
204
204
|
let(:job) { NetSuite::Records::Job.new(:entity_id => 'TEST JOB', :account_number => 7) }
|
|
205
205
|
|
|
206
206
|
it 'returns a hash of attributes that can be used in a SOAP request' do
|
|
207
|
-
job.to_record.
|
|
207
|
+
expect(job.to_record).to eql({
|
|
208
208
|
'listRel:entityId' => 'TEST JOB',
|
|
209
209
|
'listRel:accountNumber' => 7
|
|
210
210
|
})
|
|
@@ -213,7 +213,7 @@ describe NetSuite::Records::Job do
|
|
|
213
213
|
|
|
214
214
|
describe '#record_type' do
|
|
215
215
|
it 'returns a string type for the record to be used in a SOAP request' do
|
|
216
|
-
job.record_type.
|
|
216
|
+
expect(job.record_type).to eql('listRel:Job')
|
|
217
217
|
end
|
|
218
218
|
end
|
|
219
219
|
|
|
@@ -4,7 +4,7 @@ describe NetSuite::Records::JournalEntryLineList do
|
|
|
4
4
|
let(:list) { NetSuite::Records::JournalEntryLineList.new }
|
|
5
5
|
|
|
6
6
|
it 'has a custom_fields attribute' do
|
|
7
|
-
list.lines.
|
|
7
|
+
expect(list.lines).to be_kind_of(Array)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe '#to_record' do
|
|
@@ -19,7 +19,7 @@ describe NetSuite::Records::JournalEntryLineList do
|
|
|
19
19
|
'tranGeneral:memo' => 'This is a memo'
|
|
20
20
|
}]
|
|
21
21
|
}
|
|
22
|
-
list.to_record.
|
|
22
|
+
expect(list.to_record).to eql(record)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -7,7 +7,7 @@ describe NetSuite::Records::JournalEntryLine do
|
|
|
7
7
|
[
|
|
8
8
|
:credit, :debit, :eliminate, :end_date, :gross_amt, :memo, :residual, :start_date, :tax1_amt, :tax_rate1
|
|
9
9
|
].each do |field|
|
|
10
|
-
line.
|
|
10
|
+
expect(line).to have_field(field)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ describe NetSuite::Records::JournalEntryLine do
|
|
|
15
15
|
[
|
|
16
16
|
:account, :department, :entity, :klass, :location, :schedule, :schedule_num, :tax1_acct, :tax_code
|
|
17
17
|
].each do |record_ref|
|
|
18
|
-
line.
|
|
18
|
+
expect(line).to have_record_ref(record_ref)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -28,14 +28,14 @@ describe NetSuite::Records::JournalEntryLine do
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
line.custom_field_list = attributes
|
|
31
|
-
line.custom_field_list.
|
|
32
|
-
line.custom_field_list.custom_fields.length.
|
|
31
|
+
expect(line.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
|
|
32
|
+
expect(line.custom_field_list.custom_fields.length).to eql(1)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it 'can be set from a CustomFieldList object' do
|
|
36
36
|
custom_field_list = NetSuite::Records::CustomFieldList.new
|
|
37
37
|
line.custom_field_list = custom_field_list
|
|
38
|
-
line.custom_field_list.
|
|
38
|
+
expect(line.custom_field_list).to eql(custom_field_list)
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -43,7 +43,7 @@ describe NetSuite::Records::JournalEntryLine do
|
|
|
43
43
|
let(:line) { NetSuite::Records::JournalEntryLine.new(:memo => 'This is a memo', :eliminate => true) }
|
|
44
44
|
|
|
45
45
|
it 'returns a hash of attributes that can be used in a SOAP request' do
|
|
46
|
-
line.to_record.
|
|
46
|
+
expect(line.to_record).to eql({
|
|
47
47
|
'tranGeneral:memo' => 'This is a memo',
|
|
48
48
|
'tranGeneral:eliminate' => true
|
|
49
49
|
})
|
|
@@ -52,7 +52,7 @@ describe NetSuite::Records::JournalEntryLine do
|
|
|
52
52
|
|
|
53
53
|
describe '#record_type' do
|
|
54
54
|
it 'returns a string type for the record to be used in a SOAP request' do
|
|
55
|
-
line.record_type.
|
|
55
|
+
expect(line.record_type).to eql('tranGeneral:JournalEntryLine')
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -8,7 +8,7 @@ describe NetSuite::Records::JournalEntry do
|
|
|
8
8
|
:approved, :created_date, :exchange_rate, :last_modified_date, :reversal_date,
|
|
9
9
|
:reversal_defer, :reversal_entry, :tran_date, :tran_id
|
|
10
10
|
].each do |field|
|
|
11
|
-
entry.
|
|
11
|
+
expect(entry).to have_field(field)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ describe NetSuite::Records::JournalEntry do
|
|
|
17
17
|
:created_from, :currency, :custom_form, :department, :klass, :location, :parent_expense_alloc, :posting_period,
|
|
18
18
|
:subsidiary, :to_subsidiary
|
|
19
19
|
].each do |record_ref|
|
|
20
|
-
entry.
|
|
20
|
+
expect(entry).to have_record_ref(record_ref)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -30,15 +30,15 @@ describe NetSuite::Records::JournalEntry do
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
entry.custom_field_list = attributes
|
|
33
|
-
entry.custom_field_list.
|
|
34
|
-
entry.custom_field_list.custom_fields.length.
|
|
35
|
-
entry.custom_field_list.custfield_amount.attributes[:amount].
|
|
33
|
+
expect(entry.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
|
|
34
|
+
expect(entry.custom_field_list.custom_fields.length).to eql(1)
|
|
35
|
+
expect(entry.custom_field_list.custfield_amount.attributes[:amount]).to eq(10)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
it 'can be set from a CustomFieldList object' do
|
|
39
39
|
custom_field_list = NetSuite::Records::CustomFieldList.new
|
|
40
40
|
entry.custom_field_list = custom_field_list
|
|
41
|
-
entry.custom_field_list.
|
|
41
|
+
expect(entry.custom_field_list).to eql(custom_field_list)
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -50,14 +50,14 @@ describe NetSuite::Records::JournalEntry do
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
entry.line_list = attributes
|
|
53
|
-
entry.line_list.
|
|
54
|
-
entry.line_list.lines.length.
|
|
53
|
+
expect(entry.line_list).to be_kind_of(NetSuite::Records::JournalEntryLineList)
|
|
54
|
+
expect(entry.line_list.lines.length).to eql(1)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
it 'can be set from a JournalEntryLineList object' do
|
|
58
58
|
line_list = NetSuite::Records::JournalEntryLineList.new
|
|
59
59
|
entry.line_list = line_list
|
|
60
|
-
entry.line_list.
|
|
60
|
+
expect(entry.line_list).to eql(line_list)
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -66,10 +66,10 @@ describe NetSuite::Records::JournalEntry do
|
|
|
66
66
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :approved => true }) }
|
|
67
67
|
|
|
68
68
|
it 'returns a JournalEntry instance populated with the data from the response object' do
|
|
69
|
-
NetSuite::Actions::Get.
|
|
69
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::JournalEntry, {:external_id => 1}], {}).and_return(response)
|
|
70
70
|
customer = NetSuite::Records::JournalEntry.get(:external_id => 1)
|
|
71
|
-
customer.
|
|
72
|
-
customer.approved.
|
|
71
|
+
expect(customer).to be_kind_of(NetSuite::Records::JournalEntry)
|
|
72
|
+
expect(customer.approved).to be_truthy
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
@@ -77,10 +77,10 @@ describe NetSuite::Records::JournalEntry do
|
|
|
77
77
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
78
78
|
|
|
79
79
|
it 'raises a RecordNotFound exception' do
|
|
80
|
-
NetSuite::Actions::Get.
|
|
81
|
-
|
|
80
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::JournalEntry, {:external_id => 1}], {}).and_return(response)
|
|
81
|
+
expect {
|
|
82
82
|
NetSuite::Records::JournalEntry.get(:external_id => 1)
|
|
83
|
-
}.
|
|
83
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
84
84
|
/NetSuite::Records::JournalEntry with OPTIONS=(.*) could not be found/)
|
|
85
85
|
end
|
|
86
86
|
end
|
|
@@ -93,10 +93,10 @@ describe NetSuite::Records::JournalEntry do
|
|
|
93
93
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
|
94
94
|
|
|
95
95
|
it 'returns true' do
|
|
96
|
-
NetSuite::Actions::Add.
|
|
96
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
97
97
|
with([entry], {}).
|
|
98
98
|
and_return(response)
|
|
99
|
-
entry.add.
|
|
99
|
+
expect(entry.add).to be_truthy
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
|
|
@@ -104,10 +104,10 @@ describe NetSuite::Records::JournalEntry do
|
|
|
104
104
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
105
105
|
|
|
106
106
|
it 'returns false' do
|
|
107
|
-
NetSuite::Actions::Add.
|
|
107
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
108
108
|
with([entry], {}).
|
|
109
109
|
and_return(response)
|
|
110
|
-
entry.add.
|
|
110
|
+
expect(entry.add).to be_falsey
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
end
|
|
@@ -117,10 +117,10 @@ describe NetSuite::Records::JournalEntry 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::Delete.
|
|
120
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
121
121
|
with([entry], {}).
|
|
122
122
|
and_return(response)
|
|
123
|
-
entry.delete.
|
|
123
|
+
expect(entry.delete).to be_truthy
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
126
|
|
|
@@ -128,10 +128,10 @@ describe NetSuite::Records::JournalEntry do
|
|
|
128
128
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
129
129
|
|
|
130
130
|
it 'returns false' do
|
|
131
|
-
NetSuite::Actions::Delete.
|
|
131
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
132
132
|
with([entry], {}).
|
|
133
133
|
and_return(response)
|
|
134
|
-
entry.delete.
|
|
134
|
+
expect(entry.delete).to be_falsey
|
|
135
135
|
end
|
|
136
136
|
end
|
|
137
137
|
end
|
|
@@ -140,7 +140,7 @@ describe NetSuite::Records::JournalEntry do
|
|
|
140
140
|
let(:entry) { NetSuite::Records::JournalEntry.new(:tran_id => '1234', :approved => true) }
|
|
141
141
|
|
|
142
142
|
it 'returns a hash of attributes that can be used in a SOAP request' do
|
|
143
|
-
entry.to_record.
|
|
143
|
+
expect(entry.to_record).to eql({
|
|
144
144
|
'tranGeneral:tranId' => '1234',
|
|
145
145
|
'tranGeneral:approved' => true
|
|
146
146
|
})
|
|
@@ -149,7 +149,7 @@ describe NetSuite::Records::JournalEntry do
|
|
|
149
149
|
|
|
150
150
|
describe '#record_type' do
|
|
151
151
|
it 'returns a string type for the record to be used in a SOAP request' do
|
|
152
|
-
entry.record_type.
|
|
152
|
+
expect(entry.record_type).to eql('tranGeneral:JournalEntry')
|
|
153
153
|
end
|
|
154
154
|
end
|
|
155
155
|
|
|
@@ -8,7 +8,7 @@ describe NetSuite::Records::Location do
|
|
|
8
8
|
:addr1, :addr2, :addr3, :addr_phone, :addr_text, :addressee, :attention, :city, :country, :include_children, :is_inactive,
|
|
9
9
|
:make_inventory_available, :make_inventory_available_store, :name, :override, :state, :tran_prefix, :zip
|
|
10
10
|
].each do |field|
|
|
11
|
-
location.
|
|
11
|
+
expect(location).to have_field(field)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ describe NetSuite::Records::Location do
|
|
|
16
16
|
[
|
|
17
17
|
:logo, :parent
|
|
18
18
|
].each do |record_ref|
|
|
19
|
-
location.
|
|
19
|
+
expect(location).to have_record_ref(record_ref)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -40,10 +40,10 @@ describe NetSuite::Records::Location do
|
|
|
40
40
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :city => 'Los Angeles' }) }
|
|
41
41
|
|
|
42
42
|
it 'returns a Location instance populated with the data from the response object' do
|
|
43
|
-
NetSuite::Actions::Get.
|
|
43
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Location, {:external_id => 1}], {}).and_return(response)
|
|
44
44
|
location = NetSuite::Records::Location.get(:external_id => 1)
|
|
45
|
-
location.
|
|
46
|
-
location.city.
|
|
45
|
+
expect(location).to be_kind_of(NetSuite::Records::Location)
|
|
46
|
+
expect(location.city).to eql('Los Angeles')
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -51,10 +51,10 @@ describe NetSuite::Records::Location do
|
|
|
51
51
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
52
52
|
|
|
53
53
|
it 'raises a RecordNotFound exception' do
|
|
54
|
-
NetSuite::Actions::Get.
|
|
55
|
-
|
|
54
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Location, {:external_id => 1}], {}).and_return(response)
|
|
55
|
+
expect {
|
|
56
56
|
NetSuite::Records::Location.get(:external_id => 1)
|
|
57
|
-
}.
|
|
57
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
58
58
|
/NetSuite::Records::Location with OPTIONS=(.*) could not be found/)
|
|
59
59
|
end
|
|
60
60
|
end
|