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
@@ -10,7 +10,7 @@ describe NetSuite::Records::SalesTaxItem do
|
|
10
10
|
:exempt, :is_default, :exclude_from_tax_reports, :available, :export,
|
11
11
|
:county, :city, :state, :zip
|
12
12
|
].each do |field|
|
13
|
-
sales_tax_item.
|
13
|
+
expect(sales_tax_item).to have_field(field)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -19,7 +19,7 @@ describe NetSuite::Records::SalesTaxItem do
|
|
19
19
|
:tax_type, :tax_agency, :tax_account, :purchase_account, :sale_account,
|
20
20
|
:parent, :nexus_country
|
21
21
|
].each do |record_ref|
|
22
|
-
sales_tax_item.
|
22
|
+
expect(sales_tax_item).to have_record_ref(record_ref)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -16,12 +16,12 @@ describe NetSuite::Records::ServiceSaleItem do
|
|
16
16
|
:store_description, :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component,
|
17
17
|
:use_marginal_rates, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :vsoe_sop_group
|
18
18
|
].each do |field|
|
19
|
-
item.
|
19
|
+
expect(item).to have_field(field)
|
20
20
|
end
|
21
21
|
|
22
22
|
# TODO there is a probably a more robust way to test this
|
23
|
-
item.custom_field_list.class.
|
24
|
-
item.pricing_matrix.class.
|
23
|
+
expect(item.custom_field_list.class).to eq(NetSuite::Records::CustomFieldList)
|
24
|
+
expect(item.pricing_matrix.class).to eq(NetSuite::Records::PricingMatrix)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'has the right record_refs' do
|
@@ -31,7 +31,7 @@ describe NetSuite::Records::ServiceSaleItem do
|
|
31
31
|
:quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :store_display_image,
|
32
32
|
:store_display_thumbnail, :store_item_template, :subsidiary_list, :tax_schedule, :units_type
|
33
33
|
].each do |record_ref|
|
34
|
-
item.
|
34
|
+
expect(item).to have_record_ref(record_ref)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -40,10 +40,10 @@ describe NetSuite::Records::ServiceSaleItem do
|
|
40
40
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :item_id => 'penguins' }) }
|
41
41
|
|
42
42
|
it 'returns a ServiceSaleItem 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::ServiceSaleItem, :external_id => 20], {}).and_return(response)
|
44
44
|
customer = NetSuite::Records::ServiceSaleItem.get(:external_id => 20)
|
45
|
-
customer.
|
46
|
-
customer.item_id.
|
45
|
+
expect(customer).to be_kind_of(NetSuite::Records::ServiceSaleItem)
|
46
|
+
expect(customer.item_id).to eql('penguins')
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -51,10 +51,10 @@ describe NetSuite::Records::ServiceSaleItem 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::ServiceSaleItem, :external_id => 20], {}).and_return(response)
|
55
|
+
expect {
|
56
56
|
NetSuite::Records::ServiceSaleItem.get(:external_id => 20)
|
57
|
-
}.
|
57
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
58
58
|
/NetSuite::Records::ServiceSaleItem with OPTIONS=(.*) could not be found/)
|
59
59
|
end
|
60
60
|
end
|
@@ -67,10 +67,10 @@ describe NetSuite::Records::ServiceSaleItem do
|
|
67
67
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
68
68
|
|
69
69
|
it 'returns true' do
|
70
|
-
NetSuite::Actions::Add.
|
70
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
71
71
|
with([item], {}).
|
72
72
|
and_return(response)
|
73
|
-
item.add.
|
73
|
+
expect(item.add).to be_truthy
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -78,10 +78,10 @@ describe NetSuite::Records::ServiceSaleItem do
|
|
78
78
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
79
79
|
|
80
80
|
it 'returns false' do
|
81
|
-
NetSuite::Actions::Add.
|
81
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
82
82
|
with([item], {}).
|
83
83
|
and_return(response)
|
84
|
-
item.add.
|
84
|
+
expect(item.add).to be_falsey
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
@@ -91,10 +91,10 @@ describe NetSuite::Records::ServiceSaleItem do
|
|
91
91
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
92
92
|
|
93
93
|
it 'returns true' do
|
94
|
-
NetSuite::Actions::Delete.
|
94
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
95
95
|
with([item], {}).
|
96
96
|
and_return(response)
|
97
|
-
item.delete.
|
97
|
+
expect(item.delete).to be_truthy
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -102,10 +102,10 @@ describe NetSuite::Records::ServiceSaleItem do
|
|
102
102
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
103
103
|
|
104
104
|
it 'returns false' do
|
105
|
-
NetSuite::Actions::Delete.
|
105
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
106
106
|
with([item], {}).
|
107
107
|
and_return(response)
|
108
|
-
item.delete.
|
108
|
+
expect(item.delete).to be_falsey
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|
@@ -121,13 +121,13 @@ describe NetSuite::Records::ServiceSaleItem do
|
|
121
121
|
'listAcct:itemId' => 'penguins',
|
122
122
|
'listAcct:isOnline' => true
|
123
123
|
}
|
124
|
-
item.to_record.
|
124
|
+
expect(item.to_record).to eql(record)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
128
|
describe '#record_type' do
|
129
129
|
it 'returns a string of the SOAP type' do
|
130
|
-
item.record_type.
|
130
|
+
expect(item.record_type).to eql('listAcct:ServiceSaleItem')
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
@@ -8,7 +8,7 @@ describe NetSuite::Records::ShipAddress do
|
|
8
8
|
:ship_attention, :ship_addressee, :ship_phone, :ship_addr1, :ship_addr2, :ship_addr3,
|
9
9
|
:ship_city, :ship_state, :ship_zip, :ship_country, :ship_is_residential
|
10
10
|
].each do |field|
|
11
|
-
ship_address.
|
11
|
+
expect(ship_address).to have_field(field)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -23,13 +23,13 @@ describe NetSuite::Records::ShipAddress do
|
|
23
23
|
'platformCommon:shipAttention' => 'Mr. Smith',
|
24
24
|
'platformCommon:shipZip' => '90007'
|
25
25
|
}
|
26
|
-
ship_address.to_record.
|
26
|
+
expect(ship_address.to_record).to eql(record)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
describe '#record_type' do
|
31
31
|
it 'returns a string of the SOAP record type' do
|
32
|
-
ship_address.record_type.
|
32
|
+
expect(ship_address.record_type).to eql('platformCommon:ShipAddress')
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -10,7 +10,7 @@ describe NetSuite::Records::SiteCategory do
|
|
10
10
|
:search_keywords, :sitemap_priority, :store_detailed_description,
|
11
11
|
:translations_list, :url_component
|
12
12
|
].each do |field|
|
13
|
-
site_category.
|
13
|
+
expect(site_category).to have_field(field)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -19,7 +19,7 @@ describe NetSuite::Records::SiteCategory do
|
|
19
19
|
:category_list_layout, :correlated_items_list_layout, :item_list_layout, :parent_category,
|
20
20
|
:related_items_list_layout, :store_display_image, :store_display_thumbnail, :website
|
21
21
|
].each do |record_ref|
|
22
|
-
site_category.
|
22
|
+
expect(site_category).to have_record_ref(record_ref)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -28,10 +28,10 @@ describe NetSuite::Records::SiteCategory do
|
|
28
28
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :url_component => 'some url' }) }
|
29
29
|
|
30
30
|
it 'returns a SiteCategory instance populated with the data from the response object' do
|
31
|
-
NetSuite::Actions::Get.
|
31
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::SiteCategory, :external_id => 1], {}).and_return(response)
|
32
32
|
site_category = NetSuite::Records::SiteCategory.get(:external_id => 1)
|
33
|
-
site_category.
|
34
|
-
site_category.url_component.
|
33
|
+
expect(site_category).to be_kind_of(NetSuite::Records::SiteCategory)
|
34
|
+
expect(site_category.url_component).to eq('some url')
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -39,10 +39,10 @@ describe NetSuite::Records::SiteCategory do
|
|
39
39
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
40
40
|
|
41
41
|
it 'raises a RecordNotFound exception' do
|
42
|
-
NetSuite::Actions::Get.
|
43
|
-
|
42
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::SiteCategory, :external_id => 1], {}).and_return(response)
|
43
|
+
expect {
|
44
44
|
NetSuite::Records::SiteCategory.get(:external_id => 1)
|
45
|
-
}.
|
45
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
46
46
|
/NetSuite::Records::SiteCategory with OPTIONS=(.*) could not be found/)
|
47
47
|
end
|
48
48
|
end
|
@@ -12,14 +12,14 @@ describe NetSuite::Records::Subsidiary do
|
|
12
12
|
:federal_id_number, :addr_language, :non_consol, :consol, :ship_address1,
|
13
13
|
:ship_address2, :ship_city, :ship_state, :ship_country, :ship_zip,
|
14
14
|
:state1_tax_number, :ssn_or_tin, :inbound_email ].each do |field|
|
15
|
-
subsidiary.
|
15
|
+
expect(subsidiary).to have_field(field)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'has all the right record refs' do
|
20
20
|
[ :check_layout, :inter_co_account, :parent, :logo, :page_logo,
|
21
21
|
:fiscal_calendar, :tax_fiscal_calendar, :currency ].each do |record_ref|
|
22
|
-
subsidiary.
|
22
|
+
expect(subsidiary).to have_record_ref(record_ref)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -9,7 +9,7 @@ describe NetSuite::Records::SupportCase do
|
|
9
9
|
:internal_only, :title, :case_number, :start_date, :email, :phone, :inbound_email,
|
10
10
|
:is_inactive, :help_desk
|
11
11
|
].each do |field|
|
12
|
-
support_case.
|
12
|
+
expect(support_case).to have_field(field)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -17,7 +17,7 @@ describe NetSuite::Records::SupportCase do
|
|
17
17
|
[
|
18
18
|
:custom_form, :company, :contact, :issue, :status, :priority, :origin, :category, :assigned
|
19
19
|
].each do |record_ref|
|
20
|
-
support_case.
|
20
|
+
expect(support_case).to have_record_ref(record_ref)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -30,14 +30,14 @@ describe NetSuite::Records::SupportCase do
|
|
30
30
|
}
|
31
31
|
}
|
32
32
|
support_case.custom_field_list = attributes
|
33
|
-
support_case.custom_field_list.
|
34
|
-
support_case.custom_field_list.custom_fields.length.
|
33
|
+
expect(support_case.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
|
34
|
+
expect(support_case.custom_field_list.custom_fields.length).to eql(1)
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'can be set from a CustomFieldList object' do
|
38
38
|
custom_field_list = NetSuite::Records::CustomFieldList.new
|
39
39
|
support_case.custom_field_list = custom_field_list
|
40
|
-
support_case.custom_field_list.
|
40
|
+
expect(support_case.custom_field_list).to eql(custom_field_list)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -46,10 +46,10 @@ describe NetSuite::Records::SupportCase do
|
|
46
46
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :title => 'Case title' }) }
|
47
47
|
|
48
48
|
it 'returns a SupportCase instance populated with the data from the response object' do
|
49
|
-
NetSuite::Actions::Get.
|
49
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::SupportCase, :external_id => 1], {}).and_return(response)
|
50
50
|
support_case = NetSuite::Records::SupportCase.get(:external_id => 1)
|
51
|
-
support_case.
|
52
|
-
support_case.title.
|
51
|
+
expect(support_case).to be_kind_of(NetSuite::Records::SupportCase)
|
52
|
+
expect(support_case.title).to eq('Case title')
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -57,10 +57,10 @@ describe NetSuite::Records::SupportCase do
|
|
57
57
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
58
58
|
|
59
59
|
it 'raises a RecordNotFound exception' do
|
60
|
-
NetSuite::Actions::Get.
|
61
|
-
|
60
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::SupportCase, :external_id => 1], {}).and_return(response)
|
61
|
+
expect {
|
62
62
|
NetSuite::Records::SupportCase.get(:external_id => 1)
|
63
|
-
}.
|
63
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
64
64
|
/NetSuite::Records::SupportCase with OPTIONS=(.*) could not be found/)
|
65
65
|
end
|
66
66
|
end
|
@@ -73,10 +73,10 @@ describe NetSuite::Records::SupportCase do
|
|
73
73
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
74
74
|
|
75
75
|
it 'returns true' do
|
76
|
-
NetSuite::Actions::Add.
|
76
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
77
77
|
with([support_case], {}).
|
78
78
|
and_return(response)
|
79
|
-
support_case.add.
|
79
|
+
expect(support_case.add).to be_truthy
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -84,10 +84,10 @@ describe NetSuite::Records::SupportCase do
|
|
84
84
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
85
85
|
|
86
86
|
it 'returns false' do
|
87
|
-
NetSuite::Actions::Add.
|
87
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
88
88
|
with([support_case], {}).
|
89
89
|
and_return(response)
|
90
|
-
support_case.add.
|
90
|
+
expect(support_case.add).to be_falsey
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -97,10 +97,10 @@ describe NetSuite::Records::SupportCase do
|
|
97
97
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
98
98
|
|
99
99
|
it 'returns true' do
|
100
|
-
NetSuite::Actions::Delete.
|
100
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
101
101
|
with([support_case], {}).
|
102
102
|
and_return(response)
|
103
|
-
support_case.delete.
|
103
|
+
expect(support_case.delete).to be_truthy
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -108,10 +108,10 @@ describe NetSuite::Records::SupportCase do
|
|
108
108
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
109
109
|
|
110
110
|
it 'returns false' do
|
111
|
-
NetSuite::Actions::Delete.
|
111
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
112
112
|
with([support_case], {}).
|
113
113
|
and_return(response)
|
114
|
-
support_case.delete.
|
114
|
+
expect(support_case.delete).to be_falsey
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
@@ -121,9 +121,9 @@ describe NetSuite::Records::SupportCase do
|
|
121
121
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :title => 'Case title' }) }
|
122
122
|
|
123
123
|
it 'returns true' do
|
124
|
-
NetSuite::Actions::Update.
|
124
|
+
expect(NetSuite::Actions::Update).to receive(:call).with([NetSuite::Records::SupportCase, :external_id => 1, :title => 'Case title'], {}).and_return(response)
|
125
125
|
support_case = NetSuite::Records::SupportCase.new(:external_id => 1)
|
126
|
-
support_case.update(:title => 'Case title').
|
126
|
+
expect(support_case.update(:title => 'Case title')).to be_truthy
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -131,9 +131,9 @@ describe NetSuite::Records::SupportCase do
|
|
131
131
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
132
132
|
|
133
133
|
it 'raises a RecordNotFound exception' do
|
134
|
-
NetSuite::Actions::Update.
|
134
|
+
expect(NetSuite::Actions::Update).to receive(:call).with([NetSuite::Records::SupportCase, :internal_id => 1, :title => 'Case title'], {}).and_return(response)
|
135
135
|
support_case = NetSuite::Records::SupportCase.new(:internal_id => 1)
|
136
|
-
support_case.update(:title => 'Case title').
|
136
|
+
expect(support_case.update(:title => 'Case title')).to be_falsey
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
@@ -142,7 +142,7 @@ describe NetSuite::Records::SupportCase do
|
|
142
142
|
let(:support_case) { NetSuite::Records::SupportCase.new(:title => 'Case title') }
|
143
143
|
|
144
144
|
it 'returns a hash of attributes that can be used in a SOAP request' do
|
145
|
-
support_case.to_record.
|
145
|
+
expect(support_case.to_record).to eql({
|
146
146
|
'listSupport:title' => 'Case title'
|
147
147
|
})
|
148
148
|
end
|
@@ -150,7 +150,7 @@ describe NetSuite::Records::SupportCase do
|
|
150
150
|
|
151
151
|
describe '#record_type' do
|
152
152
|
it 'returns a string type for the record to be used in a SOAP request' do
|
153
|
-
support_case.record_type.
|
153
|
+
expect(support_case.record_type).to eql('listSupport:SupportCase')
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -8,7 +8,7 @@ describe NetSuite::Records::Term do
|
|
8
8
|
:name, :date_driven, :days_until_next_due, :discount_percent, :days_until_expiry, :day_of_month_net_due,
|
9
9
|
:due_next_month_if_within_days, :discount_percent_date_driven, :day_discount_expires, :preferred, :is_inactive
|
10
10
|
].each do |field|
|
11
|
-
term.
|
11
|
+
expect(term).to have_field(field)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -17,10 +17,10 @@ describe NetSuite::Records::Term do
|
|
17
17
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :name => 'Term 1' }) }
|
18
18
|
|
19
19
|
it 'returns a Term instance populated with the data from the response object' do
|
20
|
-
NetSuite::Actions::Get.
|
20
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Term, {:external_id => 1}], {}).and_return(response)
|
21
21
|
term = NetSuite::Records::Term.get(:external_id => 1)
|
22
|
-
term.
|
23
|
-
term.name.
|
22
|
+
expect(term).to be_kind_of(NetSuite::Records::Term)
|
23
|
+
expect(term.name).to eql('Term 1')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -28,10 +28,10 @@ describe NetSuite::Records::Term do
|
|
28
28
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
29
29
|
|
30
30
|
it 'raises a RecordNotFound exception' do
|
31
|
-
NetSuite::Actions::Get.
|
32
|
-
|
31
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Term, {:external_id => 1}], {}).and_return(response)
|
32
|
+
expect {
|
33
33
|
NetSuite::Records::Term.get(:external_id => 1)
|
34
|
-
}.
|
34
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
35
35
|
/NetSuite::Records::Term with OPTIONS=(.*) could not be found/)
|
36
36
|
end
|
37
37
|
end
|
@@ -45,10 +45,10 @@ describe NetSuite::Records::Term do
|
|
45
45
|
|
46
46
|
it 'returns true' do
|
47
47
|
term = NetSuite::Records::Term.new(test_data)
|
48
|
-
NetSuite::Actions::Add.
|
48
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
49
49
|
with([term], {}).
|
50
50
|
and_return(response)
|
51
|
-
term.add.
|
51
|
+
expect(term.add).to be_truthy
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -57,10 +57,10 @@ describe NetSuite::Records::Term do
|
|
57
57
|
|
58
58
|
it 'returns false' do
|
59
59
|
term = NetSuite::Records::Term.new(test_data)
|
60
|
-
NetSuite::Actions::Add.
|
60
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
61
61
|
with([term], {}).
|
62
62
|
and_return(response)
|
63
|
-
term.add.
|
63
|
+
expect(term.add).to be_falsey
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -73,10 +73,10 @@ describe NetSuite::Records::Term do
|
|
73
73
|
|
74
74
|
it 'returns true' do
|
75
75
|
term = NetSuite::Records::Term.new(test_data)
|
76
|
-
NetSuite::Actions::Delete.
|
76
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
77
77
|
with([term], {}).
|
78
78
|
and_return(response)
|
79
|
-
term.delete.
|
79
|
+
expect(term.delete).to be_truthy
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -85,10 +85,10 @@ describe NetSuite::Records::Term do
|
|
85
85
|
|
86
86
|
it 'returns false' do
|
87
87
|
term = NetSuite::Records::Term.new(test_data)
|
88
|
-
NetSuite::Actions::Delete.
|
88
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
89
89
|
with([term], {}).
|
90
90
|
and_return(response)
|
91
|
-
term.delete.
|
91
|
+
expect(term.delete).to be_falsey
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|