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.
Files changed (93) hide show
  1. data/README.md +1 -1
  2. data/lib/netsuite.rb +0 -1
  3. data/lib/netsuite/actions/search.rb +5 -0
  4. data/lib/netsuite/records/file.rb +3 -8
  5. data/lib/netsuite/support/country.rb +2 -2
  6. data/lib/netsuite/version.rb +1 -1
  7. data/netsuite.gemspec +1 -1
  8. data/spec/netsuite/actions/add_spec.rb +14 -14
  9. data/spec/netsuite/actions/delete_spec.rb +2 -2
  10. data/spec/netsuite/actions/get_spec.rb +3 -3
  11. data/spec/netsuite/actions/initialize_spec.rb +2 -2
  12. data/spec/netsuite/actions/search_spec.rb +6 -6
  13. data/spec/netsuite/actions/update_spec.rb +16 -16
  14. data/spec/netsuite/actions/upsert_list_spec.rb +4 -4
  15. data/spec/netsuite/actions/upsert_spec.rb +14 -14
  16. data/spec/netsuite/configuration_spec.rb +21 -21
  17. data/spec/netsuite/records/account_spec.rb +16 -16
  18. data/spec/netsuite/records/accounting_period_spec.rb +16 -16
  19. data/spec/netsuite/records/assembly_item_spec.rb +2 -2
  20. data/spec/netsuite/records/bill_address_spec.rb +3 -3
  21. data/spec/netsuite/records/billing_schedule_milestone_list_spec.rb +4 -4
  22. data/spec/netsuite/records/billing_schedule_milestone_spec.rb +6 -6
  23. data/spec/netsuite/records/billing_schedule_recurrence_list_spec.rb +4 -4
  24. data/spec/netsuite/records/billing_schedule_recurrence_spec.rb +6 -6
  25. data/spec/netsuite/records/billing_schedule_spec.rb +20 -20
  26. data/spec/netsuite/records/campaign_spec.rb +7 -7
  27. data/spec/netsuite/records/classification_spec.rb +10 -10
  28. data/spec/netsuite/records/credit_memo_apply_list_spec.rb +2 -2
  29. data/spec/netsuite/records/credit_memo_apply_spec.rb +1 -1
  30. data/spec/netsuite/records/credit_memo_item_list_spec.rb +2 -2
  31. data/spec/netsuite/records/credit_memo_item_spec.rb +2 -2
  32. data/spec/netsuite/records/credit_memo_spec.rb +26 -26
  33. data/spec/netsuite/records/custom_field_list_spec.rb +10 -10
  34. data/spec/netsuite/records/custom_list_spec.rb +3 -3
  35. data/spec/netsuite/records/custom_record_spec.rb +20 -20
  36. data/spec/netsuite/records/custom_record_type_spec.rb +16 -16
  37. data/spec/netsuite/records/customer_addressbook_list_spec.rb +2 -2
  38. data/spec/netsuite/records/customer_addressbook_spec.rb +38 -28
  39. data/spec/netsuite/records/customer_payment_spec.rb +23 -23
  40. data/spec/netsuite/records/customer_refund_apply_list_spec.rb +2 -2
  41. data/spec/netsuite/records/customer_refund_apply_spec.rb +1 -1
  42. data/spec/netsuite/records/customer_refund_deposit_list_spec.rb +2 -2
  43. data/spec/netsuite/records/customer_refund_deposit_spec.rb +1 -1
  44. data/spec/netsuite/records/customer_refund_spec.rb +28 -28
  45. data/spec/netsuite/records/customer_spec.rb +24 -24
  46. data/spec/netsuite/records/department_spec.rb +16 -16
  47. data/spec/netsuite/records/deposit_spec.rb +24 -24
  48. data/spec/netsuite/records/discount_item_spec.rb +19 -19
  49. data/spec/netsuite/records/duration_spec.rb +1 -1
  50. data/spec/netsuite/records/inventory_item_spec.rb +18 -18
  51. data/spec/netsuite/records/inventory_transfer_spec.rb +5 -5
  52. data/spec/netsuite/records/invoice_item_list_spec.rb +4 -4
  53. data/spec/netsuite/records/invoice_item_spec.rb +11 -11
  54. data/spec/netsuite/records/invoice_spec.rb +32 -32
  55. data/spec/netsuite/records/item_fulfillment_package_list_spec.rb +2 -2
  56. data/spec/netsuite/records/job_spec.rb +31 -31
  57. data/spec/netsuite/records/journal_entry_line_list_spec.rb +2 -2
  58. data/spec/netsuite/records/journal_entry_line_spec.rb +7 -7
  59. data/spec/netsuite/records/journal_entry_spec.rb +25 -25
  60. data/spec/netsuite/records/location_spec.rb +8 -8
  61. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +20 -20
  62. data/spec/netsuite/records/payment_method_spec.rb +8 -8
  63. data/spec/netsuite/records/phone_call_spec.rb +2 -2
  64. data/spec/netsuite/records/pomo_code_spec.rb +7 -7
  65. data/spec/netsuite/records/record_ref_spec.rb +12 -12
  66. data/spec/netsuite/records/rev_rec_template_spec.rb +7 -7
  67. data/spec/netsuite/records/sales_order_item_list_spec.rb +2 -2
  68. data/spec/netsuite/records/sales_order_item_spec.rb +2 -2
  69. data/spec/netsuite/records/sales_order_spec.rb +23 -23
  70. data/spec/netsuite/records/sales_tax_item_spec.rb +2 -2
  71. data/spec/netsuite/records/service_sale_item_spec.rb +20 -20
  72. data/spec/netsuite/records/ship_address_spec.rb +3 -3
  73. data/spec/netsuite/records/site_category_spec.rb +8 -8
  74. data/spec/netsuite/records/subsidiary_spec.rb +2 -2
  75. data/spec/netsuite/records/support_case_spec.rb +25 -25
  76. data/spec/netsuite/records/tax_type_spec.rb +1 -1
  77. data/spec/netsuite/records/term_spec.rb +15 -15
  78. data/spec/netsuite/records/units_type_spec.rb +4 -4
  79. data/spec/netsuite/records/units_type_uom_list_spec.rb +4 -4
  80. data/spec/netsuite/records/units_type_uom_spec.rb +1 -1
  81. data/spec/netsuite/records/work_order_item_list_spec.rb +2 -2
  82. data/spec/netsuite/records/work_order_item_spec.rb +4 -4
  83. data/spec/netsuite/records/work_order_spec.rb +13 -13
  84. data/spec/netsuite/response_spec.rb +4 -4
  85. data/spec/netsuite/support/fields_spec.rb +6 -6
  86. data/spec/netsuite/support/record_refs_spec.rb +1 -1
  87. data/spec/netsuite/support/records_spec.rb +2 -2
  88. data/spec/netsuite/support/requests_spec.rb +6 -6
  89. data/spec/netsuite_spec.rb +4 -4
  90. data/spec/spec_helper.rb +0 -2
  91. data/spec/support/read_only_field_matcher.rb +1 -1
  92. data/spec/support/record_ref_matcher.rb +2 -2
  93. metadata +4 -4
@@ -11,7 +11,7 @@ describe NetSuite::Records::Campaign do
11
11
  :offer, :owner, :profit, :promotion_code, :roi, :search_engine, :start_date, :title,
12
12
  :total_revenue, :unique_visitors, :url, :vertical
13
13
  ].each do |field|
14
- campaign.should have_field(field)
14
+ expect(campaign).to have_field(field)
15
15
  end
16
16
  end
17
17
 
@@ -20,10 +20,10 @@ describe NetSuite::Records::Campaign do
20
20
  let(:response) { NetSuite::Response.new(:success => true, :body => { :message => 'Message 1' }) }
21
21
 
22
22
  it 'returns a Campaign instance populated with the data from the response object' do
23
- NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Campaign, {:external_id => 1}], {}).and_return(response)
23
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Campaign, {:external_id => 1}], {}).and_return(response)
24
24
  campaign = NetSuite::Records::Campaign.get(:external_id => 1)
25
- campaign.should be_kind_of(NetSuite::Records::Campaign)
26
- campaign.message.should eql('Message 1')
25
+ expect(campaign).to be_kind_of(NetSuite::Records::Campaign)
26
+ expect(campaign.message).to eql('Message 1')
27
27
  end
28
28
  end
29
29
 
@@ -31,10 +31,10 @@ describe NetSuite::Records::Campaign do
31
31
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
32
32
 
33
33
  it 'raises a RecordNotFound exception' do
34
- NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Campaign, {:external_id => 1}], {}).and_return(response)
35
- lambda {
34
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Campaign, {:external_id => 1}], {}).and_return(response)
35
+ expect {
36
36
  NetSuite::Records::Campaign.get(:external_id => 1)
37
- }.should raise_error(NetSuite::RecordNotFound,
37
+ }.to raise_error(NetSuite::RecordNotFound,
38
38
  /NetSuite::Records::Campaign with OPTIONS=(.*) could not be found/)
39
39
  end
40
40
  end
@@ -7,7 +7,7 @@ describe NetSuite::Records::Classification do
7
7
  [
8
8
  :name, :include_children, :is_inactive, :class_translation_list, :subsidiary_list, :custom_field_list
9
9
  ].each do |field|
10
- classification.should have_field(field)
10
+ expect(classification).to have_field(field)
11
11
  end
12
12
  end
13
13
 
@@ -16,9 +16,9 @@ describe NetSuite::Records::Classification do
16
16
  let(:response) { NetSuite::Response.new(:success => true, :body => { :name => 'Retail' }) }
17
17
 
18
18
  it 'returns an Invoice instance populated with the data from the response object' do
19
- NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Classification, {:external_id => 10}], {}).and_return(response)
19
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Classification, {:external_id => 10}], {}).and_return(response)
20
20
  invoice = NetSuite::Records::Classification.get(:external_id => 10)
21
- invoice.should be_kind_of(NetSuite::Records::Classification)
21
+ expect(invoice).to be_kind_of(NetSuite::Records::Classification)
22
22
  end
23
23
  end
24
24
 
@@ -26,10 +26,10 @@ describe NetSuite::Records::Classification do
26
26
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
27
27
 
28
28
  it 'raises a RecordNotFound exception' do
29
- NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Classification, {:external_id => 10}], {}).and_return(response)
30
- lambda {
29
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::Classification, {:external_id => 10}], {}).and_return(response)
30
+ expect {
31
31
  NetSuite::Records::Classification.get(:external_id => 10)
32
- }.should raise_error(NetSuite::RecordNotFound,
32
+ }.to raise_error(NetSuite::RecordNotFound,
33
33
  /NetSuite::Records::Classification with OPTIONS=(.*) could not be found/)
34
34
  end
35
35
  end
@@ -43,10 +43,10 @@ describe NetSuite::Records::Classification do
43
43
 
44
44
  it 'returns true' do
45
45
  classification = NetSuite::Records::Classification.new(test_data)
46
- NetSuite::Actions::Delete.should_receive(:call).
46
+ expect(NetSuite::Actions::Delete).to receive(:call).
47
47
  with([classification], {}).
48
48
  and_return(response)
49
- classification.delete.should be_truthy
49
+ expect(classification.delete).to be_truthy
50
50
  end
51
51
  end
52
52
 
@@ -55,10 +55,10 @@ describe NetSuite::Records::Classification do
55
55
 
56
56
  it 'returns false' do
57
57
  classification = NetSuite::Records::Classification.new(test_data)
58
- NetSuite::Actions::Delete.should_receive(:call).
58
+ expect(NetSuite::Actions::Delete).to receive(:call).
59
59
  with([classification], {}).
60
60
  and_return(response)
61
- classification.delete.should be_falsey
61
+ expect(classification.delete).to be_falsey
62
62
  end
63
63
  end
64
64
  end
@@ -4,7 +4,7 @@ describe NetSuite::Records::CreditMemoApplyList do
4
4
  let(:list) { NetSuite::Records::CreditMemoApplyList.new }
5
5
 
6
6
  it 'has a applies attribute' do
7
- list.applies.should be_kind_of(Array)
7
+ expect(list.applies).to be_kind_of(Array)
8
8
  end
9
9
 
10
10
  describe '#to_record' do
@@ -22,7 +22,7 @@ describe NetSuite::Records::CreditMemoApplyList do
22
22
  }
23
23
  }
24
24
  ]
25
- list.to_record.should eql(record)
25
+ expect(list.to_record).to eql(record)
26
26
  end
27
27
  end
28
28
  end
@@ -7,7 +7,7 @@ describe NetSuite::Records::CreditMemoApply do
7
7
  [
8
8
  :amount, :apply, :apply_date, :currency, :doc, :due, :job, :line, :ref_num, :total, :type
9
9
  ].each do |field|
10
- apply.should have_field(field)
10
+ expect(apply).to have_field(field)
11
11
  end
12
12
  end
13
13
 
@@ -4,7 +4,7 @@ describe NetSuite::Records::CreditMemoItemList do
4
4
  let(:list) { NetSuite::Records::CreditMemoItemList.new }
5
5
 
6
6
  it 'has a items attribute' do
7
- list.items.should be_kind_of(Array)
7
+ expect(list.items).to be_kind_of(Array)
8
8
  end
9
9
 
10
10
  describe '#to_record' do
@@ -22,7 +22,7 @@ describe NetSuite::Records::CreditMemoItemList do
22
22
  }
23
23
  }
24
24
  ]
25
- list.to_record.should eql(record)
25
+ expect(list.to_record).to eql(record)
26
26
  end
27
27
  end
28
28
  end
@@ -11,7 +11,7 @@ describe NetSuite::Records::CreditMemoItem do
11
11
  :tax1_amt, :tax_rate1, :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount,
12
12
  :vsoe_price
13
13
  ].each do |field|
14
- item.should have_field(field)
14
+ expect(item).to have_field(field)
15
15
  end
16
16
  end
17
17
 
@@ -19,7 +19,7 @@ describe NetSuite::Records::CreditMemoItem do
19
19
  [
20
20
  :department, :item, :job, :klass, :location, :price, :rev_rec_schedule, :tax_code, :units
21
21
  ].each do |record_ref|
22
- item.should have_record_ref(record_ref)
22
+ expect(item).to have_record_ref(record_ref)
23
23
  end
24
24
  end
25
25
 
@@ -16,7 +16,7 @@ describe NetSuite::Records::CreditMemo do
16
16
  :sync_sales_teams, :tax2_total, :tax_rate, :tax_total, :to_be_emailed, :to_be_faxed, :to_be_printed, :total,
17
17
  :total_cost_estimate, :tran_date, :tran_id, :tran_is_vsoe_bundle, :unapplied, :vat_reg_num, :vsoe_auto_calc
18
18
  ].each do |field|
19
- memo.should have_field(field)
19
+ expect(memo).to have_field(field)
20
20
  end
21
21
  end
22
22
 
@@ -26,7 +26,7 @@ describe NetSuite::Records::CreditMemo do
26
26
  :handling_tax_code, :job, :klass, :lead_source, :location, :message_sel, :partner, :posting_period, :promo_code,
27
27
  :sales_group, :sales_rep, :ship_method, :shipping_tax_code, :subsidiary, :tax_item
28
28
  ].each do |record_ref|
29
- memo.should have_record_ref(record_ref)
29
+ expect(memo).to have_record_ref(record_ref)
30
30
  end
31
31
  end
32
32
 
@@ -38,14 +38,14 @@ describe NetSuite::Records::CreditMemo do
38
38
  }
39
39
  }
40
40
  memo.item_list = attributes
41
- memo.item_list.should be_kind_of(NetSuite::Records::CreditMemoItemList)
42
- memo.item_list.items.length.should eql(1)
41
+ expect(memo.item_list).to be_kind_of(NetSuite::Records::CreditMemoItemList)
42
+ expect(memo.item_list.items.length).to eql(1)
43
43
  end
44
44
 
45
45
  it 'can be set from a CreditMemoItemList object' do
46
46
  item_list = NetSuite::Records::CreditMemoItemList.new
47
47
  memo.item_list = item_list
48
- memo.item_list.should eql(item_list)
48
+ expect(memo.item_list).to eql(item_list)
49
49
  end
50
50
  end
51
51
 
@@ -57,14 +57,14 @@ describe NetSuite::Records::CreditMemo do
57
57
  }
58
58
  }
59
59
  memo.apply_list = attributes
60
- memo.apply_list.should be_kind_of(NetSuite::Records::CreditMemoApplyList)
61
- memo.apply_list.applies.length.should eql(1)
60
+ expect(memo.apply_list).to be_kind_of(NetSuite::Records::CreditMemoApplyList)
61
+ expect(memo.apply_list.applies.length).to eql(1)
62
62
  end
63
63
 
64
64
  it 'can be set from a CreditMemoApplyList object' do
65
65
  apply_list = NetSuite::Records::CreditMemoApplyList.new
66
66
  memo.apply_list = apply_list
67
- memo.apply_list.should eql(apply_list)
67
+ expect(memo.apply_list).to eql(apply_list)
68
68
  end
69
69
  end
70
70
 
@@ -98,10 +98,10 @@ describe NetSuite::Records::CreditMemo do
98
98
  let(:response) { NetSuite::Response.new(:success => true, :body => { :alt_shipping_cost => 100 }) }
99
99
 
100
100
  it 'returns a CreditMemo instance populated with the data from the response object' do
101
- NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CreditMemo, {:external_id => 1}], {}).and_return(response)
101
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CreditMemo, {:external_id => 1}], {}).and_return(response)
102
102
  memo = NetSuite::Records::CreditMemo.get(:external_id => 1)
103
- memo.should be_kind_of(NetSuite::Records::CreditMemo)
104
- memo.alt_shipping_cost.should eql(100)
103
+ expect(memo).to be_kind_of(NetSuite::Records::CreditMemo)
104
+ expect(memo.alt_shipping_cost).to eql(100)
105
105
  end
106
106
  end
107
107
 
@@ -109,10 +109,10 @@ describe NetSuite::Records::CreditMemo do
109
109
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
110
110
 
111
111
  it 'raises a RecordNotFound exception' do
112
- NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CreditMemo, {:external_id => 1}], {}).and_return(response)
113
- lambda {
112
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CreditMemo, {:external_id => 1}], {}).and_return(response)
113
+ expect {
114
114
  NetSuite::Records::CreditMemo.get(:external_id => 1)
115
- }.should raise_error(NetSuite::RecordNotFound,
115
+ }.to raise_error(NetSuite::RecordNotFound,
116
116
  /NetSuite::Records::CreditMemo with OPTIONS=(.*) could not be found/)
117
117
  end
118
118
  end
@@ -121,9 +121,9 @@ describe NetSuite::Records::CreditMemo do
121
121
  describe '.initialize' do
122
122
  context 'when the request is successful' do
123
123
  it 'returns an initialized credit memo from the customer entity' do
124
- NetSuite::Actions::Initialize.should_receive(:call).with([NetSuite::Records::CreditMemo, customer], {}).and_return(response)
124
+ expect(NetSuite::Actions::Initialize).to receive(:call).with([NetSuite::Records::CreditMemo, customer], {}).and_return(response)
125
125
  invoice = NetSuite::Records::CreditMemo.initialize(customer)
126
- invoice.should be_kind_of(NetSuite::Records::CreditMemo)
126
+ expect(invoice).to be_kind_of(NetSuite::Records::CreditMemo)
127
127
  end
128
128
  end
129
129
 
@@ -140,10 +140,10 @@ describe NetSuite::Records::CreditMemo do
140
140
 
141
141
  it 'returns true' do
142
142
  memo = NetSuite::Records::CreditMemo.new(test_data)
143
- NetSuite::Actions::Add.should_receive(:call).
143
+ expect(NetSuite::Actions::Add).to receive(:call).
144
144
  with([memo], {}).
145
145
  and_return(response)
146
- memo.add.should be_truthy
146
+ expect(memo.add).to be_truthy
147
147
  end
148
148
  end
149
149
 
@@ -152,10 +152,10 @@ describe NetSuite::Records::CreditMemo do
152
152
 
153
153
  it 'returns false' do
154
154
  memo = NetSuite::Records::CreditMemo.new(test_data)
155
- NetSuite::Actions::Add.should_receive(:call).
155
+ expect(NetSuite::Actions::Add).to receive(:call).
156
156
  with([memo], {}).
157
157
  and_return(response)
158
- memo.add.should be_falsey
158
+ expect(memo.add).to be_falsey
159
159
  end
160
160
  end
161
161
  end
@@ -168,10 +168,10 @@ describe NetSuite::Records::CreditMemo do
168
168
 
169
169
  it 'returns true' do
170
170
  memo = NetSuite::Records::CreditMemo.new(test_data)
171
- NetSuite::Actions::Delete.should_receive(:call).
171
+ expect(NetSuite::Actions::Delete).to receive(:call).
172
172
  with([memo], {}).
173
173
  and_return(response)
174
- memo.delete.should be_truthy
174
+ expect(memo.delete).to be_truthy
175
175
  end
176
176
  end
177
177
 
@@ -180,10 +180,10 @@ describe NetSuite::Records::CreditMemo do
180
180
 
181
181
  it 'returns false' do
182
182
  memo = NetSuite::Records::CreditMemo.new(test_data)
183
- NetSuite::Actions::Delete.should_receive(:call).
183
+ expect(NetSuite::Actions::Delete).to receive(:call).
184
184
  with([memo], {}).
185
185
  and_return(response)
186
- memo.delete.should be_falsey
186
+ expect(memo.delete).to be_falsey
187
187
  end
188
188
  end
189
189
  end
@@ -198,13 +198,13 @@ describe NetSuite::Records::CreditMemo do
198
198
  'tranCust:email' => 'something@example.com',
199
199
  'tranCust:tranId' => '4'
200
200
  }
201
- memo.to_record.should eql(record)
201
+ expect(memo.to_record).to eql(record)
202
202
  end
203
203
  end
204
204
 
205
205
  describe '#record_type' do
206
206
  it 'returns a string representation of the SOAP type' do
207
- memo.record_type.should eql('tranCust:CreditMemo')
207
+ expect(memo.record_type).to eql('tranCust:CreditMemo')
208
208
  end
209
209
  end
210
210
 
@@ -4,31 +4,31 @@ describe NetSuite::Records::CustomFieldList do
4
4
  let(:list) { NetSuite::Records::CustomFieldList.new }
5
5
 
6
6
  it 'has a custom_fields attribute' do
7
- list.custom_fields.should be_kind_of(Array)
7
+ expect(list.custom_fields).to be_kind_of(Array)
8
8
  end
9
9
 
10
10
  context 'writing convience methods' do
11
11
  it "should create a custom field entry when none exists" do
12
12
  list.custrecord_somefield = 'a value'
13
- list.custom_fields.size.should == 1
14
- list.custom_fields.first.value.should == 'a value'
15
- list.custom_fields.first.type.should == 'platformCore:StringCustomFieldRef'
13
+ expect(list.custom_fields.size).to eq(1)
14
+ expect(list.custom_fields.first.value).to eq('a value')
15
+ expect(list.custom_fields.first.type).to eq('platformCore:StringCustomFieldRef')
16
16
  end
17
17
 
18
18
  it "should handle date custom field creation" do
19
19
  list.custrecord_somefield = Date.parse("12/12/2012")
20
- list.custom_fields.first.value.should == '2012-12-12T00:00:00+00:00'
20
+ expect(list.custom_fields.first.value).to eq('2012-12-12T00:00:00+00:00')
21
21
  end
22
22
 
23
23
  it "should handle datetime custom field creation" do
24
24
  list.custrecord_somefield = DateTime.parse("12/12/2012 10:05am")
25
- list.custom_fields.first.value.should == '2012-12-12T10:05:00+00:00'
25
+ expect(list.custom_fields.first.value).to eq('2012-12-12T10:05:00+00:00')
26
26
  end
27
27
 
28
28
  it "should convert a list of numbers into a list of custom field refs" do
29
29
  list.custrecord_somefield = [1,2]
30
- list.custom_fields.first.type.should == 'platformCore:MultiSelectCustomFieldRef'
31
- list.custom_fields.first.value.map(&:to_record).should eql([
30
+ expect(list.custom_fields.first.type).to eq('platformCore:MultiSelectCustomFieldRef')
31
+ expect(list.custom_fields.first.value.map(&:to_record)).to eql([
32
32
  NetSuite::Records::CustomRecordRef.new(:internal_id => 1),
33
33
  NetSuite::Records::CustomRecordRef.new(:internal_id => 2)
34
34
  ].map(&:to_record))
@@ -75,8 +75,8 @@ describe NetSuite::Records::CustomFieldList do
75
75
  ]
76
76
  }
77
77
 
78
- list.to_record.should eql(record)
79
- list.to_record.length.should == 1
78
+ expect(list.to_record).to eql(record)
79
+ expect(list.to_record.length).to eq(1)
80
80
  end
81
81
  end
82
82
 
@@ -4,7 +4,7 @@ describe NetSuite::Records::CustomList do
4
4
  let(:custom_list) { NetSuite::Records::CustomList.new }
5
5
 
6
6
  it 'has all the right fields' do
7
- custom_list.should have_field(:script_id)
7
+ expect(custom_list).to have_field(:script_id)
8
8
  end
9
9
 
10
10
  it "should handle the #custom_value_list" do
@@ -15,7 +15,7 @@ describe NetSuite::Records::CustomList do
15
15
  }
16
16
  ]}
17
17
 
18
- custom_list.custom_value_list.should be_kind_of(NetSuite::Support::Sublist)
19
- custom_list.custom_value_list.custom_value.first.should be_kind_of(NetSuite::Records::CustomListCustomValue)
18
+ expect(custom_list.custom_value_list).to be_kind_of(NetSuite::Support::Sublist)
19
+ expect(custom_list.custom_value_list.custom_value.first).to be_kind_of(NetSuite::Records::CustomListCustomValue)
20
20
  end
21
21
  end
@@ -12,7 +12,7 @@ describe NetSuite::Records::CustomRecord do
12
12
  :show_creation_date_on_list, :show_id, :show_last_modified, :show_last_modified_on_list, :show_notes, :show_owner,
13
13
  :show_owner_allow_change, :show_owner_on_list, :use_permissions
14
14
  ].each do |field|
15
- record.should have_field(field)
15
+ expect(record).to have_field(field)
16
16
  end
17
17
  end
18
18
 
@@ -20,7 +20,7 @@ describe NetSuite::Records::CustomRecord do
20
20
  [
21
21
  :custom_form, :owner
22
22
  ].each do |record_ref|
23
- record.should have_record_ref(record_ref)
23
+ expect(record).to have_record_ref(record_ref)
24
24
  end
25
25
  end
26
26
 
@@ -33,15 +33,15 @@ describe NetSuite::Records::CustomRecord do
33
33
  }
34
34
  }
35
35
  record.custom_field_list = attributes
36
- record.custom_field_list.should be_kind_of(NetSuite::Records::CustomFieldList)
37
- record.custom_field_list.custom_fields.length.should eql(1)
38
- record.custom_field_list.custfield_amount.attributes[:amount].should eq(10)
36
+ expect(record.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
37
+ expect(record.custom_field_list.custom_fields.length).to eql(1)
38
+ expect(record.custom_field_list.custfield_amount.attributes[:amount]).to eq(10)
39
39
  end
40
40
 
41
41
  it 'can be set from a CustomFieldList object' do
42
42
  custom_field_list = NetSuite::Records::CustomFieldList.new
43
43
  record.custom_field_list = custom_field_list
44
- record.custom_field_list.should eql(custom_field_list)
44
+ expect(record.custom_field_list).to eql(custom_field_list)
45
45
  end
46
46
  end
47
47
 
@@ -50,12 +50,12 @@ describe NetSuite::Records::CustomRecord do
50
50
  let(:response) { NetSuite::Response.new(:success => true, :body => { :allow_quick_search => true }) }
51
51
 
52
52
  it 'returns a Customer instance populated with the data from the response object' do
53
- NetSuite::Actions::Get.should_receive(:call).
53
+ expect(NetSuite::Actions::Get).to receive(:call).
54
54
  with([NetSuite::Records::CustomRecord, {:external_id => 1, :type_id => nil, :custom => true}], {}).
55
55
  and_return(response)
56
56
  customer = NetSuite::Records::CustomRecord.get(:external_id => 1)
57
- customer.should be_kind_of(NetSuite::Records::CustomRecord)
58
- customer.allow_quick_search.should be_truthy
57
+ expect(customer).to be_kind_of(NetSuite::Records::CustomRecord)
58
+ expect(customer.allow_quick_search).to be_truthy
59
59
  end
60
60
  end
61
61
 
@@ -63,12 +63,12 @@ describe NetSuite::Records::CustomRecord do
63
63
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
64
64
 
65
65
  it 'raises a RecordNotFound exception' do
66
- NetSuite::Actions::Get.should_receive(:call).
66
+ expect(NetSuite::Actions::Get).to receive(:call).
67
67
  with([NetSuite::Records::CustomRecord, {:external_id => 1, :type_id => nil, :custom => true}], {}).
68
68
  and_return(response)
69
- lambda {
69
+ expect {
70
70
  NetSuite::Records::CustomRecord.get(:external_id => 1)
71
- }.should raise_error(NetSuite::RecordNotFound,
71
+ }.to raise_error(NetSuite::RecordNotFound,
72
72
  /NetSuite::Records::CustomRecord with OPTIONS=(.*) could not be found/)
73
73
  end
74
74
  end
@@ -79,10 +79,10 @@ describe NetSuite::Records::CustomRecord do
79
79
  let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
80
80
 
81
81
  it 'returns true' do
82
- NetSuite::Actions::Add.should_receive(:call).
82
+ expect(NetSuite::Actions::Add).to receive(:call).
83
83
  with([record], {}).
84
84
  and_return(response)
85
- record.add.should be_truthy
85
+ expect(record.add).to be_truthy
86
86
  end
87
87
  end
88
88
 
@@ -90,10 +90,10 @@ describe NetSuite::Records::CustomRecord do
90
90
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
91
91
 
92
92
  it 'returns false' do
93
- NetSuite::Actions::Add.should_receive(:call).
93
+ expect(NetSuite::Actions::Add).to receive(:call).
94
94
  with([record], {}).
95
95
  and_return(response)
96
- record.add.should be_falsey
96
+ expect(record.add).to be_falsey
97
97
  end
98
98
  end
99
99
  end
@@ -103,10 +103,10 @@ describe NetSuite::Records::CustomRecord do
103
103
  let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
104
104
 
105
105
  it 'returns true' do
106
- NetSuite::Actions::Delete.should_receive(:call).
106
+ expect(NetSuite::Actions::Delete).to receive(:call).
107
107
  with([record, { :custom => true }], {}).
108
108
  and_return(response)
109
- record.delete.should be_truthy
109
+ expect(record.delete).to be_truthy
110
110
  end
111
111
  end
112
112
 
@@ -114,10 +114,10 @@ describe NetSuite::Records::CustomRecord do
114
114
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
115
115
 
116
116
  it 'returns false' do
117
- NetSuite::Actions::Delete.should_receive(:call).
117
+ expect(NetSuite::Actions::Delete).to receive(:call).
118
118
  with([record, { :custom => true }], {}).
119
119
  and_return(response)
120
- record.delete.should be_falsey
120
+ expect(record.delete).to be_falsey
121
121
  end
122
122
  end
123
123
  end