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
|
@@ -8,7 +8,7 @@ describe NetSuite::Records::Account do
|
|
|
8
8
|
:acct_name, :acct_number, :acct_type, :cash_flow_rate, :cur_doc_num, :description, :eliminate, :exchange_rate,
|
|
9
9
|
:general_rate, :include_children, :inventory, :is_inactive, :opening_balance, :revalue, :tran_date
|
|
10
10
|
].each do |field|
|
|
11
|
-
account.
|
|
11
|
+
expect(account).to have_field(field)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ describe NetSuite::Records::Account do
|
|
|
16
16
|
[
|
|
17
17
|
:billable_expenses_acct, :category1099misc, :currency, :deferral_acct, :department, :klass, :location, :parent
|
|
18
18
|
].each do |record_ref|
|
|
19
|
-
account.
|
|
19
|
+
expect(account).to have_record_ref(record_ref)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -40,10 +40,10 @@ describe NetSuite::Records::Account do
|
|
|
40
40
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :acct_name => 'Account 1' }) }
|
|
41
41
|
|
|
42
42
|
it 'returns a Account 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::Account, {:external_id => 1}], {}).and_return(response)
|
|
44
44
|
account = NetSuite::Records::Account.get(:external_id => 1)
|
|
45
|
-
account.
|
|
46
|
-
account.acct_name.
|
|
45
|
+
expect(account).to be_kind_of(NetSuite::Records::Account)
|
|
46
|
+
expect(account.acct_name).to eql('Account 1')
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -51,10 +51,10 @@ describe NetSuite::Records::Account 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::Account, {:external_id => 1}], {}).and_return(response)
|
|
55
|
+
expect {
|
|
56
56
|
NetSuite::Records::Account.get(:external_id => 1)
|
|
57
|
-
}.
|
|
57
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
58
58
|
/NetSuite::Records::Account with OPTIONS=(.*) could not be found/)
|
|
59
59
|
end
|
|
60
60
|
end
|
|
@@ -68,10 +68,10 @@ describe NetSuite::Records::Account do
|
|
|
68
68
|
|
|
69
69
|
it 'returns true' do
|
|
70
70
|
account = NetSuite::Records::Account.new(test_data)
|
|
71
|
-
NetSuite::Actions::Add.
|
|
71
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
72
72
|
with([account], {}).
|
|
73
73
|
and_return(response)
|
|
74
|
-
account.add.
|
|
74
|
+
expect(account.add).to be_truthy
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
|
|
@@ -80,10 +80,10 @@ describe NetSuite::Records::Account do
|
|
|
80
80
|
|
|
81
81
|
it 'returns false' do
|
|
82
82
|
account = NetSuite::Records::Account.new(test_data)
|
|
83
|
-
NetSuite::Actions::Add.
|
|
83
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
84
84
|
with([account], {}).
|
|
85
85
|
and_return(response)
|
|
86
|
-
account.add.
|
|
86
|
+
expect(account.add).to be_falsey
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
end
|
|
@@ -96,10 +96,10 @@ describe NetSuite::Records::Account do
|
|
|
96
96
|
|
|
97
97
|
it 'returns true' do
|
|
98
98
|
account = NetSuite::Records::Account.new(test_data)
|
|
99
|
-
NetSuite::Actions::Delete.
|
|
99
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
100
100
|
with([account], {}).
|
|
101
101
|
and_return(response)
|
|
102
|
-
account.delete.
|
|
102
|
+
expect(account.delete).to be_truthy
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
|
|
@@ -108,10 +108,10 @@ describe NetSuite::Records::Account do
|
|
|
108
108
|
|
|
109
109
|
it 'returns false' do
|
|
110
110
|
account = NetSuite::Records::Account.new(test_data)
|
|
111
|
-
NetSuite::Actions::Delete.
|
|
111
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
112
112
|
with([account], {}).
|
|
113
113
|
and_return(response)
|
|
114
|
-
account.delete.
|
|
114
|
+
expect(account.delete).to be_falsey
|
|
115
115
|
end
|
|
116
116
|
end
|
|
117
117
|
end
|
|
@@ -7,7 +7,7 @@ describe NetSuite::Records::AccountingPeriod do
|
|
|
7
7
|
[
|
|
8
8
|
:allow_non_gl_changes, :end_date, :is_adjust, :is_quarter, :is_year, :period_name, :start_date
|
|
9
9
|
].each do |field|
|
|
10
|
-
accounting_period.
|
|
10
|
+
expect(accounting_period).to have_field(field)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ describe NetSuite::Records::AccountingPeriod do
|
|
|
15
15
|
[
|
|
16
16
|
:parent
|
|
17
17
|
].each do |record_ref|
|
|
18
|
-
accounting_period.
|
|
18
|
+
expect(accounting_period).to have_record_ref(record_ref)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -24,10 +24,10 @@ describe NetSuite::Records::AccountingPeriod do
|
|
|
24
24
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :period_name => 'Accounting Period 1' }) }
|
|
25
25
|
|
|
26
26
|
it 'returns a Account 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::AccountingPeriod, {:external_id => 1}], {}).and_return(response)
|
|
28
28
|
accounting_period = NetSuite::Records::AccountingPeriod.get(:external_id => 1)
|
|
29
|
-
accounting_period.
|
|
30
|
-
accounting_period.period_name.
|
|
29
|
+
expect(accounting_period).to be_kind_of(NetSuite::Records::AccountingPeriod)
|
|
30
|
+
expect(accounting_period.period_name).to eql('Accounting Period 1')
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -35,10 +35,10 @@ describe NetSuite::Records::AccountingPeriod 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::AccountingPeriod, {:external_id => 1}], {}).and_return(response)
|
|
39
|
+
expect {
|
|
40
40
|
NetSuite::Records::AccountingPeriod.get(:external_id => 1)
|
|
41
|
-
}.
|
|
41
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
42
42
|
/NetSuite::Records::AccountingPeriod with OPTIONS=(.*) could not be found/)
|
|
43
43
|
end
|
|
44
44
|
end
|
|
@@ -88,10 +88,10 @@ describe NetSuite::Records::AccountingPeriod do
|
|
|
88
88
|
|
|
89
89
|
it 'returns true' do
|
|
90
90
|
accounting_period = NetSuite::Records::AccountingPeriod.new(test_data)
|
|
91
|
-
NetSuite::Actions::Add.
|
|
91
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
92
92
|
with([accounting_period], {}).
|
|
93
93
|
and_return(response)
|
|
94
|
-
accounting_period.add.
|
|
94
|
+
expect(accounting_period.add).to be_truthy
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
|
|
@@ -100,10 +100,10 @@ describe NetSuite::Records::AccountingPeriod do
|
|
|
100
100
|
|
|
101
101
|
it 'returns false' do
|
|
102
102
|
accounting_period = NetSuite::Records::AccountingPeriod.new(test_data)
|
|
103
|
-
NetSuite::Actions::Add.
|
|
103
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
104
104
|
with([accounting_period], {}).
|
|
105
105
|
and_return(response)
|
|
106
|
-
accounting_period.add.
|
|
106
|
+
expect(accounting_period.add).to be_falsey
|
|
107
107
|
end
|
|
108
108
|
end
|
|
109
109
|
end
|
|
@@ -116,10 +116,10 @@ describe NetSuite::Records::AccountingPeriod do
|
|
|
116
116
|
|
|
117
117
|
it 'returns true' do
|
|
118
118
|
accounting_period = NetSuite::Records::AccountingPeriod.new(test_data)
|
|
119
|
-
NetSuite::Actions::Delete.
|
|
119
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
120
120
|
with([accounting_period], {}).
|
|
121
121
|
and_return(response)
|
|
122
|
-
accounting_period.delete.
|
|
122
|
+
expect(accounting_period.delete).to be_truthy
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
|
|
@@ -128,10 +128,10 @@ describe NetSuite::Records::AccountingPeriod do
|
|
|
128
128
|
|
|
129
129
|
it 'returns false' do
|
|
130
130
|
accounting_period = NetSuite::Records::AccountingPeriod.new(test_data)
|
|
131
|
-
NetSuite::Actions::Delete.
|
|
131
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
132
132
|
with([accounting_period], {}).
|
|
133
133
|
and_return(response)
|
|
134
|
-
accounting_period.delete.
|
|
134
|
+
expect(accounting_period.delete).to be_falsey
|
|
135
135
|
end
|
|
136
136
|
end
|
|
137
137
|
end
|
|
@@ -12,8 +12,8 @@ describe NetSuite::Records::AssemblyItem do
|
|
|
12
12
|
}]
|
|
13
13
|
}
|
|
14
14
|
item.member_list = attributes
|
|
15
|
-
item.member_list.
|
|
16
|
-
item.member_list.item_member.length.
|
|
15
|
+
expect(item.member_list).to be_kind_of(NetSuite::Records::MemberList)
|
|
16
|
+
expect(item.member_list.item_member.length).to eql(1)
|
|
17
17
|
|
|
18
18
|
expect(item.member_list.item_member.first.item.internal_id).to eq(1)
|
|
19
19
|
expect(item.member_list.item_member.first.quantity).to eq(20)
|
|
@@ -8,7 +8,7 @@ describe NetSuite::Records::BillAddress do
|
|
|
8
8
|
:bill_attention, :bill_addressee, :bill_phone, :bill_addr1, :bill_addr2,
|
|
9
9
|
:bill_addr3, :bill_city, :bill_state, :bill_zip, :bill_country
|
|
10
10
|
].each do |field|
|
|
11
|
-
bill_address.
|
|
11
|
+
expect(bill_address).to have_field(field)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -39,13 +39,13 @@ describe NetSuite::Records::BillAddress do
|
|
|
39
39
|
'platformCommon:billZip' => '90007',
|
|
40
40
|
'platformCommon:billCountry' => '_unitedStates'
|
|
41
41
|
}
|
|
42
|
-
bill_address.to_record.
|
|
42
|
+
expect(bill_address.to_record).to eql(record)
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
describe 'record_namespace' do
|
|
47
47
|
it 'belongs to the platformCommon namespace' do
|
|
48
|
-
bill_address.record_namespace.
|
|
48
|
+
expect(bill_address.record_namespace).to eql('platformCommon')
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
@@ -7,9 +7,9 @@ describe NetSuite::Records::BillingScheduleMilestoneList do
|
|
|
7
7
|
it 'can have milestones be added to it' do
|
|
8
8
|
list.milestones << milestone
|
|
9
9
|
milestone_list = list.milestones
|
|
10
|
-
milestone_list.
|
|
11
|
-
milestone_list.length.
|
|
12
|
-
milestone_list.each { |i| i.
|
|
10
|
+
expect(milestone_list).to be_kind_of(Array)
|
|
11
|
+
expect(milestone_list.length).to eql(1)
|
|
12
|
+
milestone_list.each { |i| expect(i).to be_kind_of(NetSuite::Records::BillingScheduleMilestone) }
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
describe '#to_record' do
|
|
@@ -17,7 +17,7 @@ describe NetSuite::Records::BillingScheduleMilestoneList do
|
|
|
17
17
|
record = {
|
|
18
18
|
'listAcct:billingScheduleMilestone' => []
|
|
19
19
|
}
|
|
20
|
-
list.to_record.
|
|
20
|
+
expect(list.to_record).to eql(record)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -8,7 +8,7 @@ describe NetSuite::Records::BillingScheduleMilestone do
|
|
|
8
8
|
:comments, :milestone_actual_completion_date, :milestone_amount,
|
|
9
9
|
:milestone_completed, :milestone_date, :milestone_id
|
|
10
10
|
].each do |field|
|
|
11
|
-
milestone.
|
|
11
|
+
expect(milestone).to have_field(field)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -16,15 +16,15 @@ describe NetSuite::Records::BillingScheduleMilestone do
|
|
|
16
16
|
[
|
|
17
17
|
:milestone_term, :project_task
|
|
18
18
|
].each do |record_ref|
|
|
19
|
-
milestone.
|
|
19
|
+
expect(milestone).to have_record_ref(record_ref)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it 'can initialize from a record' do
|
|
24
24
|
record = NetSuite::Records::BillingScheduleMilestone.new(:comments => "foo")
|
|
25
25
|
milestone = NetSuite::Records::BillingScheduleMilestone.new(record)
|
|
26
|
-
milestone.
|
|
27
|
-
milestone.comments.
|
|
26
|
+
expect(milestone).to be_kind_of(NetSuite::Records::BillingScheduleMilestone)
|
|
27
|
+
expect(milestone.comments).to eql("foo")
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
describe '#to_record' do
|
|
@@ -38,13 +38,13 @@ describe NetSuite::Records::BillingScheduleMilestone do
|
|
|
38
38
|
'listAcct:comments' => 'comment',
|
|
39
39
|
'listAcct:milestoneAmount' => 1
|
|
40
40
|
}
|
|
41
|
-
milestone.to_record.
|
|
41
|
+
expect(milestone.to_record).to eql(record)
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
describe '#record_type' do
|
|
46
46
|
it 'returns a string of the SOAP record type' do
|
|
47
|
-
milestone.record_type.
|
|
47
|
+
expect(milestone.record_type).to eql('listAcct:BillingScheduleMilestone')
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -7,9 +7,9 @@ describe NetSuite::Records::BillingScheduleRecurrenceList do
|
|
|
7
7
|
it 'can have recurrences be added to it' do
|
|
8
8
|
list.recurrences << recurrence
|
|
9
9
|
recurrence_list = list.recurrences
|
|
10
|
-
recurrence_list.
|
|
11
|
-
recurrence_list.length.
|
|
12
|
-
recurrence_list.each { |i| i.
|
|
10
|
+
expect(recurrence_list).to be_kind_of(Array)
|
|
11
|
+
expect(recurrence_list.length).to eql(1)
|
|
12
|
+
recurrence_list.each { |i| expect(i).to be_kind_of(NetSuite::Records::BillingScheduleRecurrence) }
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
describe '#to_record' do
|
|
@@ -17,7 +17,7 @@ describe NetSuite::Records::BillingScheduleRecurrenceList do
|
|
|
17
17
|
record = {
|
|
18
18
|
'listAcct:billingScheduleRecurrence' => []
|
|
19
19
|
}
|
|
20
|
-
list.to_record.
|
|
20
|
+
expect(list.to_record).to eql(record)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -8,7 +8,7 @@ describe NetSuite::Records::BillingScheduleRecurrence do
|
|
|
8
8
|
:amount, :count, :recurrence_date, :recurrence_id,
|
|
9
9
|
:relative_to_previous, :units
|
|
10
10
|
].each do |field|
|
|
11
|
-
recurrence.
|
|
11
|
+
expect(recurrence).to have_field(field)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -16,15 +16,15 @@ describe NetSuite::Records::BillingScheduleRecurrence do
|
|
|
16
16
|
[
|
|
17
17
|
:payment_terms
|
|
18
18
|
].each do |record_ref|
|
|
19
|
-
recurrence.
|
|
19
|
+
expect(recurrence).to have_record_ref(record_ref)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it 'can initialize from a record' do
|
|
24
24
|
record = NetSuite::Records::BillingScheduleRecurrence.new(:amount => 10)
|
|
25
25
|
recurrence = NetSuite::Records::BillingScheduleRecurrence.new(record)
|
|
26
|
-
recurrence.
|
|
27
|
-
recurrence.amount.
|
|
26
|
+
expect(recurrence).to be_kind_of(NetSuite::Records::BillingScheduleRecurrence)
|
|
27
|
+
expect(recurrence.amount).to eql(10)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
describe '#to_record' do
|
|
@@ -36,13 +36,13 @@ describe NetSuite::Records::BillingScheduleRecurrence do
|
|
|
36
36
|
record = {
|
|
37
37
|
'listAcct:amount' => 10
|
|
38
38
|
}
|
|
39
|
-
recurrence.to_record.
|
|
39
|
+
expect(recurrence.to_record).to eql(record)
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
describe '#record_type' do
|
|
44
44
|
it 'returns a string of the SOAP record type' do
|
|
45
|
-
recurrence.record_type.
|
|
45
|
+
expect(recurrence.record_type).to eql('listAcct:BillingScheduleRecurrence')
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -11,7 +11,7 @@ describe NetSuite::Records::BillingSchedule do
|
|
|
11
11
|
:schedule_type, :series_start_date, :year_dom, :year_dow,
|
|
12
12
|
:year_dowim, :year_dowim_month, :year_mode, :year_month
|
|
13
13
|
].each do |field|
|
|
14
|
-
billing_schedule.
|
|
14
|
+
expect(billing_schedule).to have_field(field)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ describe NetSuite::Records::BillingSchedule do
|
|
|
19
19
|
[
|
|
20
20
|
:initial_terms, :project, :recurrence_terms, :transaction
|
|
21
21
|
].each do |record_ref|
|
|
22
|
-
billing_schedule.
|
|
22
|
+
expect(billing_schedule).to have_record_ref(record_ref)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -29,8 +29,8 @@ describe NetSuite::Records::BillingSchedule do
|
|
|
29
29
|
:comments => "comment"
|
|
30
30
|
}
|
|
31
31
|
billing_schedule.milestone_list.milestone = attributes
|
|
32
|
-
billing_schedule.milestone_list.
|
|
33
|
-
billing_schedule.milestone_list.milestones.length.
|
|
32
|
+
expect(billing_schedule.milestone_list).to be_kind_of(NetSuite::Records::BillingScheduleMilestoneList)
|
|
33
|
+
expect(billing_schedule.milestone_list.milestones.length).to eql(1)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -40,8 +40,8 @@ describe NetSuite::Records::BillingSchedule do
|
|
|
40
40
|
:amount => 10
|
|
41
41
|
}
|
|
42
42
|
billing_schedule.recurrence_list.recurrence = attributes
|
|
43
|
-
billing_schedule.recurrence_list.
|
|
44
|
-
billing_schedule.recurrence_list.recurrences.length.
|
|
43
|
+
expect(billing_schedule.recurrence_list).to be_kind_of(NetSuite::Records::BillingScheduleRecurrenceList)
|
|
44
|
+
expect(billing_schedule.recurrence_list.recurrences.length).to eql(1)
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -50,10 +50,10 @@ describe NetSuite::Records::BillingSchedule do
|
|
|
50
50
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :name => 'Billing Scheduleing 1' }) }
|
|
51
51
|
|
|
52
52
|
it 'returns a Billing Schedule instance populated with the data from the response object' do
|
|
53
|
-
NetSuite::Actions::Get.
|
|
53
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::BillingSchedule, {:external_id => 1}], {}).and_return(response)
|
|
54
54
|
billing_schedule = NetSuite::Records::BillingSchedule.get(:external_id => 1)
|
|
55
|
-
billing_schedule.
|
|
56
|
-
billing_schedule.name.
|
|
55
|
+
expect(billing_schedule).to be_kind_of(NetSuite::Records::BillingSchedule)
|
|
56
|
+
expect(billing_schedule.name).to eql('Billing Scheduleing 1')
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -61,10 +61,10 @@ describe NetSuite::Records::BillingSchedule do
|
|
|
61
61
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
62
62
|
|
|
63
63
|
it 'raises a RecordNotFound exception' do
|
|
64
|
-
NetSuite::Actions::Get.
|
|
65
|
-
|
|
64
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::BillingSchedule, {:external_id => 1}], {}).and_return(response)
|
|
65
|
+
expect {
|
|
66
66
|
NetSuite::Records::BillingSchedule.get(:external_id => 1)
|
|
67
|
-
}.
|
|
67
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
68
68
|
/NetSuite::Records::BillingSchedule with OPTIONS=(.*) could not be found/)
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -114,10 +114,10 @@ describe NetSuite::Records::BillingSchedule do
|
|
|
114
114
|
|
|
115
115
|
it 'returns true' do
|
|
116
116
|
billing_schedule = NetSuite::Records::BillingSchedule.new(test_data)
|
|
117
|
-
NetSuite::Actions::Add.
|
|
117
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
118
118
|
with([billing_schedule], {}).
|
|
119
119
|
and_return(response)
|
|
120
|
-
billing_schedule.add.
|
|
120
|
+
expect(billing_schedule.add).to be_truthy
|
|
121
121
|
end
|
|
122
122
|
end
|
|
123
123
|
|
|
@@ -126,10 +126,10 @@ describe NetSuite::Records::BillingSchedule do
|
|
|
126
126
|
|
|
127
127
|
it 'returns false' do
|
|
128
128
|
billing_schedule = NetSuite::Records::BillingSchedule.new(test_data)
|
|
129
|
-
NetSuite::Actions::Add.
|
|
129
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
130
130
|
with([billing_schedule], {}).
|
|
131
131
|
and_return(response)
|
|
132
|
-
billing_schedule.add.
|
|
132
|
+
expect(billing_schedule.add).to be_falsey
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
135
|
end
|
|
@@ -142,10 +142,10 @@ describe NetSuite::Records::BillingSchedule do
|
|
|
142
142
|
|
|
143
143
|
it 'returns true' do
|
|
144
144
|
billing_schedule = NetSuite::Records::BillingSchedule.new(test_data)
|
|
145
|
-
NetSuite::Actions::Delete.
|
|
145
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
146
146
|
with([billing_schedule], {}).
|
|
147
147
|
and_return(response)
|
|
148
|
-
billing_schedule.delete.
|
|
148
|
+
expect(billing_schedule.delete).to be_truthy
|
|
149
149
|
end
|
|
150
150
|
end
|
|
151
151
|
|
|
@@ -154,10 +154,10 @@ describe NetSuite::Records::BillingSchedule do
|
|
|
154
154
|
|
|
155
155
|
it 'returns false' do
|
|
156
156
|
billing_schedule = NetSuite::Records::BillingSchedule.new(test_data)
|
|
157
|
-
NetSuite::Actions::Delete.
|
|
157
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
158
158
|
with([billing_schedule], {}).
|
|
159
159
|
and_return(response)
|
|
160
|
-
billing_schedule.delete.
|
|
160
|
+
expect(billing_schedule.delete).to be_falsey
|
|
161
161
|
end
|
|
162
162
|
end
|
|
163
163
|
end
|