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::CustomRecordType do
11
11
  :record_name, :script_id, :show_creation_date, :show_creation_date_on_list, :show_id, :show_last_modified,
12
12
  :show_last_modified_on_list, :show_notes, :show_owner, :show_owner_allow_change, :show_owner_on_list, :use_permissions
13
13
  ].each do |field|
14
- record_type.should have_field(field)
14
+ expect(record_type).to have_field(field)
15
15
  end
16
16
  end
17
17
 
@@ -19,7 +19,7 @@ describe NetSuite::Records::CustomRecordType do
19
19
  [
20
20
  :owner
21
21
  ].each do |record_ref|
22
- record_type.should have_record_ref(record_ref)
22
+ expect(record_type).to have_record_ref(record_ref)
23
23
  end
24
24
  end
25
25
 
@@ -83,12 +83,12 @@ describe NetSuite::Records::CustomRecordType do
83
83
  let(:response) { NetSuite::Response.new(:success => true, :body => { :allow_attachments => true }) }
84
84
 
85
85
  it 'returns a Customer instance populated with the data from the response object' do
86
- NetSuite::Actions::Get.should_receive(:call).
86
+ expect(NetSuite::Actions::Get).to receive(:call).
87
87
  with([NetSuite::Records::CustomRecordType, :external_id => 1], {}).
88
88
  and_return(response)
89
89
  record_type = NetSuite::Records::CustomRecordType.get(:external_id => 1)
90
- record_type.should be_kind_of(NetSuite::Records::CustomRecordType)
91
- record_type.allow_attachments.should be_truthy
90
+ expect(record_type).to be_kind_of(NetSuite::Records::CustomRecordType)
91
+ expect(record_type.allow_attachments).to be_truthy
92
92
  end
93
93
  end
94
94
 
@@ -96,12 +96,12 @@ describe NetSuite::Records::CustomRecordType do
96
96
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
97
97
 
98
98
  it 'raises a RecordNotFound exception' do
99
- NetSuite::Actions::Get.should_receive(:call).
99
+ expect(NetSuite::Actions::Get).to receive(:call).
100
100
  with([NetSuite::Records::CustomRecordType, :external_id => 1], {}).
101
101
  and_return(response)
102
- lambda {
102
+ expect {
103
103
  NetSuite::Records::CustomRecordType.get(:external_id => 1)
104
- }.should raise_error(NetSuite::RecordNotFound,
104
+ }.to raise_error(NetSuite::RecordNotFound,
105
105
  /NetSuite::Records::CustomRecordType with OPTIONS=(.*) could not be found/)
106
106
  end
107
107
  end
@@ -112,10 +112,10 @@ describe NetSuite::Records::CustomRecordType do
112
112
  let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
113
113
 
114
114
  it 'returns true' do
115
- NetSuite::Actions::Add.should_receive(:call).
115
+ expect(NetSuite::Actions::Add).to receive(:call).
116
116
  with([record_type], {}).
117
117
  and_return(response)
118
- record_type.add.should be_truthy
118
+ expect(record_type.add).to be_truthy
119
119
  end
120
120
  end
121
121
 
@@ -123,10 +123,10 @@ describe NetSuite::Records::CustomRecordType do
123
123
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
124
124
 
125
125
  it 'returns false' do
126
- NetSuite::Actions::Add.should_receive(:call).
126
+ expect(NetSuite::Actions::Add).to receive(:call).
127
127
  with([record_type], {}).
128
128
  and_return(response)
129
- record_type.add.should be_falsey
129
+ expect(record_type.add).to be_falsey
130
130
  end
131
131
  end
132
132
  end
@@ -136,10 +136,10 @@ describe NetSuite::Records::CustomRecordType do
136
136
  let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
137
137
 
138
138
  it 'returns true' do
139
- NetSuite::Actions::Delete.should_receive(:call).
139
+ expect(NetSuite::Actions::Delete).to receive(:call).
140
140
  with([record_type], {}).
141
141
  and_return(response)
142
- record_type.delete.should be_truthy
142
+ expect(record_type.delete).to be_truthy
143
143
  end
144
144
  end
145
145
 
@@ -147,10 +147,10 @@ describe NetSuite::Records::CustomRecordType do
147
147
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
148
148
 
149
149
  it 'returns false' do
150
- NetSuite::Actions::Delete.should_receive(:call).
150
+ expect(NetSuite::Actions::Delete).to receive(:call).
151
151
  with([record_type], {}).
152
152
  and_return(response)
153
- record_type.delete.should be_falsey
153
+ expect(record_type.delete).to be_falsey
154
154
  end
155
155
  end
156
156
  end
@@ -4,7 +4,7 @@ describe NetSuite::Records::CustomerAddressbookList do
4
4
  let(:list) { NetSuite::Records::CustomerAddressbookList.new }
5
5
 
6
6
  it 'has an addressbooks attribute' do
7
- list.addressbooks.should be_kind_of(Array)
7
+ expect(list.addressbooks).to be_kind_of(Array)
8
8
  end
9
9
 
10
10
  describe '#to_record' do
@@ -13,7 +13,7 @@ describe NetSuite::Records::CustomerAddressbookList do
13
13
  'listRel:addressbook' => [],
14
14
  'listRel:replaceAll' => true
15
15
  }
16
- list.to_record.should eql(record)
16
+ expect(list.to_record).to eql(record)
17
17
  end
18
18
  end
19
19
 
@@ -26,7 +26,7 @@ describe NetSuite::Records::CustomerAddressbook do
26
26
  :default_shipping, :default_billing, :is_residential, :label, :attention, :addressee,
27
27
  :phone, :addr1, :addr2, :addr3, :city, :zip, :addr_text, :override, :state
28
28
  ].each do |field|
29
- list.should have_field(field)
29
+ expect(list).to have_field(field)
30
30
  end
31
31
  end
32
32
 
@@ -34,25 +34,25 @@ describe NetSuite::Records::CustomerAddressbook do
34
34
  [
35
35
  :addr_text
36
36
  ].each do |field|
37
- NetSuite::Records::CustomerAddressbook.should have_read_only_field(field)
37
+ expect(NetSuite::Records::CustomerAddressbook).to have_read_only_field(field)
38
38
  end
39
39
  end
40
40
 
41
41
  describe '#initialize' do
42
42
  context 'when taking in a hash of attributes' do
43
43
  it 'sets the attributes for the object given the attributes hash' do
44
- list.addr1.should eql('123 Happy Lane')
45
- list.addr_text.should eql("123 Happy Lane\nLos Angeles CA 90007")
46
- list.city.should eql('Los Angeles')
47
- list.country.to_record.should eql('_unitedStates')
48
- list.default_billing.should be_truthy
49
- list.default_shipping.should be_truthy
50
- list.is_residential.should be_falsey
51
- list.label.should eql('123 Happy Lane')
52
- list.override.should be_falsey
53
- list.state.should eql('CA')
54
- list.zip.should eql('90007')
55
- list.internal_id.should eql('567')
44
+ expect(list.addr1).to eql('123 Happy Lane')
45
+ expect(list.addr_text).to eql("123 Happy Lane\nLos Angeles CA 90007")
46
+ expect(list.city).to eql('Los Angeles')
47
+ expect(list.country.to_record).to eql('_unitedStates')
48
+ expect(list.default_billing).to be_truthy
49
+ expect(list.default_shipping).to be_truthy
50
+ expect(list.is_residential).to be_falsey
51
+ expect(list.label).to eql('123 Happy Lane')
52
+ expect(list.override).to be_falsey
53
+ expect(list.state).to eql('CA')
54
+ expect(list.zip).to eql('90007')
55
+ expect(list.internal_id).to eql('567')
56
56
  end
57
57
  end
58
58
 
@@ -60,18 +60,18 @@ describe NetSuite::Records::CustomerAddressbook do
60
60
  it 'sets the attributes for the object given the record attributes' do
61
61
  old_list = NetSuite::Records::CustomerAddressbook.new(attributes)
62
62
  list = NetSuite::Records::CustomerAddressbook.new(old_list)
63
- list.addr1.should eql('123 Happy Lane')
64
- list.addr_text.should eql("123 Happy Lane\nLos Angeles CA 90007")
65
- list.city.should eql('Los Angeles')
66
- list.country.to_record.should eql('_unitedStates')
67
- list.default_billing.should be_truthy
68
- list.default_shipping.should be_truthy
69
- list.is_residential.should be_falsey
70
- list.label.should eql('123 Happy Lane')
71
- list.override.should be_falsey
72
- list.state.should eql('CA')
73
- list.zip.should eql('90007')
74
- list.internal_id.should eql('567')
63
+ expect(list.addr1).to eql('123 Happy Lane')
64
+ expect(list.addr_text).to eql("123 Happy Lane\nLos Angeles CA 90007")
65
+ expect(list.city).to eql('Los Angeles')
66
+ expect(list.country.to_record).to eql('_unitedStates')
67
+ expect(list.default_billing).to be_truthy
68
+ expect(list.default_shipping).to be_truthy
69
+ expect(list.is_residential).to be_falsey
70
+ expect(list.label).to eql('123 Happy Lane')
71
+ expect(list.override).to be_falsey
72
+ expect(list.state).to eql('CA')
73
+ expect(list.zip).to eql('90007')
74
+ expect(list.internal_id).to eql('567')
75
75
  end
76
76
  end
77
77
  end
@@ -91,7 +91,7 @@ describe NetSuite::Records::CustomerAddressbook do
91
91
  'listRel:zip' => '90007',
92
92
  "listRel:internalId" => "567"
93
93
  }
94
- list.to_record.should eql(record)
94
+ expect(list.to_record).to eql(record)
95
95
  end
96
96
  end
97
97
 
@@ -113,12 +113,22 @@ describe NetSuite::Records::CustomerAddressbook do
113
113
  it "can be specified as the NetSuite enum value" do
114
114
  addressbook = NetSuite::Records::CustomerAddressbook.new country: "_unitedStates"
115
115
  addressbook.to_record["listRel:country"].should eql "_unitedStates"
116
+
117
+ # country with two uppercase letters (looks like ISO2)
118
+ addressbook = NetSuite::Records::CustomerAddressbook.new country: "_unitedKingdomGB"
119
+ addressbook.to_record["listRel:country"].should eql "_unitedKingdomGB"
120
+ end
121
+
122
+ it "can be unspecified" do
123
+ addressbook = NetSuite::Records::CustomerAddressbook.new country: ''
124
+ addressbook.country.to_record.should eql ""
125
+ addressbook.to_record["listRel:country"].should eql ""
116
126
  end
117
127
  end
118
128
 
119
129
  describe '#record_type' do
120
130
  it 'returns a string of the record SOAP type' do
121
- list.record_type.should eql('listRel:CustomerAddressbook')
131
+ expect(list.record_type).to eql('listRel:CustomerAddressbook')
122
132
  end
123
133
  end
124
134
 
@@ -12,7 +12,7 @@ describe NetSuite::Records::CustomerPayment do
12
12
  :created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :ignore_avs, :last_modified_date, :memo, :payment,
13
13
  :pending, :pn_ref_num, :status, :three_d_status_code, :total, :tran_date, :unapplied, :undep_funds, :valid_from
14
14
  ].each do |field|
15
- payment.should have_field(field)
15
+ expect(payment).to have_field(field)
16
16
  end
17
17
  end
18
18
 
@@ -20,7 +20,7 @@ describe NetSuite::Records::CustomerPayment do
20
20
  [
21
21
  :account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass, :location, :payment_method, :posting_period, :subsidiary
22
22
  ].each do |record_ref|
23
- payment.should have_record_ref(record_ref)
23
+ expect(payment).to have_record_ref(record_ref)
24
24
  end
25
25
  end
26
26
 
@@ -33,14 +33,14 @@ describe NetSuite::Records::CustomerPayment do
33
33
  }
34
34
  }
35
35
  payment.custom_field_list = attributes
36
- payment.custom_field_list.should be_kind_of(NetSuite::Records::CustomFieldList)
37
- payment.custom_field_list.custom_fields.length.should eql(1)
36
+ expect(payment.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
37
+ expect(payment.custom_field_list.custom_fields.length).to eql(1)
38
38
  end
39
39
 
40
40
  it 'can be set from a CustomFieldList object' do
41
41
  custom_field_list = NetSuite::Records::CustomFieldList.new
42
42
  payment.custom_field_list = custom_field_list
43
- payment.custom_field_list.should eql(custom_field_list)
43
+ expect(payment.custom_field_list).to eql(custom_field_list)
44
44
  end
45
45
  end
46
46
 
@@ -64,10 +64,10 @@ describe NetSuite::Records::CustomerPayment do
64
64
  let(:response) { NetSuite::Response.new(:success => true, :body => { :memo => 'This is a memo' }) }
65
65
 
66
66
  it 'returns an CustomerPayment instance populated with the data from the response object' do
67
- NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CustomerPayment, {:external_id => 7}], {}).and_return(response)
67
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CustomerPayment, {:external_id => 7}], {}).and_return(response)
68
68
  payment = NetSuite::Records::CustomerPayment.get(:external_id => 7)
69
- payment.should be_kind_of(NetSuite::Records::CustomerPayment)
70
- payment.memo.should eql('This is a memo')
69
+ expect(payment).to be_kind_of(NetSuite::Records::CustomerPayment)
70
+ expect(payment.memo).to eql('This is a memo')
71
71
  end
72
72
  end
73
73
 
@@ -75,10 +75,10 @@ describe NetSuite::Records::CustomerPayment do
75
75
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
76
76
 
77
77
  it 'raises a RecordNotFound exception' do
78
- NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CustomerPayment, {:external_id => 8}], {}).and_return(response)
79
- lambda {
78
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CustomerPayment, {:external_id => 8}], {}).and_return(response)
79
+ expect {
80
80
  NetSuite::Records::CustomerPayment.get(:external_id => 8)
81
- }.should raise_error(NetSuite::RecordNotFound,
81
+ }.to raise_error(NetSuite::RecordNotFound,
82
82
  /NetSuite::Records::CustomerPayment with OPTIONS=(.*) could not be found/)
83
83
  end
84
84
  end
@@ -87,9 +87,9 @@ describe NetSuite::Records::CustomerPayment do
87
87
  describe '.initialize' do
88
88
  context 'when the request is successful' do
89
89
  it 'returns an initialized invoice from the customer entity' do
90
- NetSuite::Actions::Initialize.should_receive(:call).with([NetSuite::Records::CustomerPayment, invoice], {}).and_return(response)
90
+ expect(NetSuite::Actions::Initialize).to receive(:call).with([NetSuite::Records::CustomerPayment, invoice], {}).and_return(response)
91
91
  payment = NetSuite::Records::CustomerPayment.initialize(invoice)
92
- payment.should be_kind_of(NetSuite::Records::CustomerPayment)
92
+ expect(payment).to be_kind_of(NetSuite::Records::CustomerPayment)
93
93
  end
94
94
  end
95
95
 
@@ -106,10 +106,10 @@ describe NetSuite::Records::CustomerPayment do
106
106
 
107
107
  it 'returns true' do
108
108
  payment = NetSuite::Records::CustomerPayment.new(test_data)
109
- NetSuite::Actions::Add.should_receive(:call).
109
+ expect(NetSuite::Actions::Add).to receive(:call).
110
110
  with([payment], {}).
111
111
  and_return(response)
112
- payment.add.should be_truthy
112
+ expect(payment.add).to be_truthy
113
113
  end
114
114
  end
115
115
 
@@ -118,10 +118,10 @@ describe NetSuite::Records::CustomerPayment do
118
118
 
119
119
  it 'returns false' do
120
120
  payment = NetSuite::Records::CustomerPayment.new(test_data)
121
- NetSuite::Actions::Add.should_receive(:call).
121
+ expect(NetSuite::Actions::Add).to receive(:call).
122
122
  with([payment], {}).
123
123
  and_return(response)
124
- payment.add.should be_falsey
124
+ expect(payment.add).to be_falsey
125
125
  end
126
126
  end
127
127
  end
@@ -131,10 +131,10 @@ describe NetSuite::Records::CustomerPayment do
131
131
  let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
132
132
 
133
133
  it 'returns true' do
134
- NetSuite::Actions::Delete.should_receive(:call).
134
+ expect(NetSuite::Actions::Delete).to receive(:call).
135
135
  with([payment], {}).
136
136
  and_return(response)
137
- payment.delete.should be_truthy
137
+ expect(payment.delete).to be_truthy
138
138
  end
139
139
  end
140
140
 
@@ -142,10 +142,10 @@ describe NetSuite::Records::CustomerPayment do
142
142
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
143
143
 
144
144
  it 'returns false' do
145
- NetSuite::Actions::Delete.should_receive(:call).
145
+ expect(NetSuite::Actions::Delete).to receive(:call).
146
146
  with([payment], {}).
147
147
  and_return(response)
148
- payment.delete.should be_falsey
148
+ expect(payment.delete).to be_falsey
149
149
  end
150
150
  end
151
151
  end
@@ -160,13 +160,13 @@ describe NetSuite::Records::CustomerPayment do
160
160
  'tranCust:ccName' => 'Ryan Moran',
161
161
  'tranCust:ccNumber' => '1234567890123456'
162
162
  }
163
- payment.to_record.should eql(record)
163
+ expect(payment.to_record).to eql(record)
164
164
  end
165
165
  end
166
166
 
167
167
  describe '#record_type' do
168
168
  it 'returns a string representation of the SOAP type' do
169
- payment.record_type.should eql('tranCust:CustomerPayment')
169
+ expect(payment.record_type).to eql('tranCust:CustomerPayment')
170
170
  end
171
171
  end
172
172
 
@@ -4,7 +4,7 @@ describe NetSuite::Records::CustomerRefundApplyList do
4
4
  let(:list) { NetSuite::Records::CustomerRefundApplyList.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
@@ -20,7 +20,7 @@ describe NetSuite::Records::CustomerRefundApplyList do
20
20
  }
21
21
  }
22
22
  ]
23
- list.to_record.should eql(record)
23
+ expect(list.to_record).to eql(record)
24
24
  end
25
25
  end
26
26
 
@@ -7,7 +7,7 @@ describe NetSuite::Records::CustomerRefundApply do
7
7
  [
8
8
  :amount, :apply, :apply_date, :currency, :doc, :due, :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::CustomerRefundDepositList do
4
4
  let(:list) { NetSuite::Records::CustomerRefundDepositList.new }
5
5
 
6
6
  it 'has a deposits attribute' do
7
- list.deposits.should be_kind_of(Array)
7
+ expect(list.deposits).to be_kind_of(Array)
8
8
  end
9
9
 
10
10
  describe '#to_record' do
@@ -18,7 +18,7 @@ describe NetSuite::Records::CustomerRefundDepositList do
18
18
  'tranCust:apply' => false
19
19
  }]
20
20
  }
21
- list.to_record.should eql(record)
21
+ expect(list.to_record).to eql(record)
22
22
  end
23
23
  end
24
24
 
@@ -7,7 +7,7 @@ describe NetSuite::Records::CustomerRefundDeposit do
7
7
  [
8
8
  :amount, :apply, :currency, :deposit_date, :doc, :line, :ref_num, :remaining, :total
9
9
  ].each do |field|
10
- deposit.should have_field(field)
10
+ expect(deposit).to have_field(field)
11
11
  end
12
12
  end
13
13
 
@@ -11,7 +11,7 @@ describe NetSuite::Records::CustomerRefund do
11
11
  :created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :last_modified_date, :memo, :pn_ref_num, :status,
12
12
  :to_be_printed, :total, :tran_date, :tran_id, :valid_from
13
13
  ].each do |field|
14
- refund.should have_field(field)
14
+ expect(refund).to have_field(field)
15
15
  end
16
16
  end
17
17
 
@@ -20,7 +20,7 @@ describe NetSuite::Records::CustomerRefund do
20
20
  :account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass, :location,
21
21
  :payment_method, :posting_period, :subsidiary, :void_journal
22
22
  ].each do |record_ref|
23
- refund.should have_record_ref(record_ref)
23
+ expect(refund).to have_record_ref(record_ref)
24
24
  end
25
25
  end
26
26
 
@@ -33,14 +33,14 @@ describe NetSuite::Records::CustomerRefund do
33
33
  }
34
34
  }
35
35
  refund.custom_field_list = attributes
36
- refund.custom_field_list.should be_kind_of(NetSuite::Records::CustomFieldList)
37
- refund.custom_field_list.custom_fields.length.should eql(1)
36
+ expect(refund.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
37
+ expect(refund.custom_field_list.custom_fields.length).to eql(1)
38
38
  end
39
39
 
40
40
  it 'can be set from a CustomFieldList object' do
41
41
  custom_field_list = NetSuite::Records::CustomFieldList.new
42
42
  refund.custom_field_list = custom_field_list
43
- refund.custom_field_list.should eql(custom_field_list)
43
+ expect(refund.custom_field_list).to eql(custom_field_list)
44
44
  end
45
45
  end
46
46
 
@@ -52,14 +52,14 @@ describe NetSuite::Records::CustomerRefund do
52
52
  }
53
53
  }
54
54
  refund.apply_list = attributes
55
- refund.apply_list.should be_kind_of(NetSuite::Records::CustomerRefundApplyList)
56
- refund.apply_list.applies.length.should eql(1)
55
+ expect(refund.apply_list).to be_kind_of(NetSuite::Records::CustomerRefundApplyList)
56
+ expect(refund.apply_list.applies.length).to eql(1)
57
57
  end
58
58
 
59
59
  it 'can be set from a CustomerRefundApplyList object' do
60
60
  apply_list = NetSuite::Records::CustomerRefundApplyList.new
61
61
  refund.apply_list = apply_list
62
- refund.apply_list.should eql(apply_list)
62
+ expect(refund.apply_list).to eql(apply_list)
63
63
  end
64
64
  end
65
65
 
@@ -71,14 +71,14 @@ describe NetSuite::Records::CustomerRefund do
71
71
  }
72
72
  }
73
73
  refund.deposit_list = attributes
74
- refund.deposit_list.should be_kind_of(NetSuite::Records::CustomerRefundDepositList)
75
- refund.deposit_list.deposits.length.should eql(1)
74
+ expect(refund.deposit_list).to be_kind_of(NetSuite::Records::CustomerRefundDepositList)
75
+ expect(refund.deposit_list.deposits.length).to eql(1)
76
76
  end
77
77
 
78
78
  it 'can be set from a CustomerRefundDepositList object' do
79
79
  deposit_list = NetSuite::Records::CustomerRefundDepositList.new
80
80
  refund.deposit_list = deposit_list
81
- refund.deposit_list.should eql(deposit_list)
81
+ expect(refund.deposit_list).to eql(deposit_list)
82
82
  end
83
83
  end
84
84
 
@@ -87,9 +87,9 @@ describe NetSuite::Records::CustomerRefund do
87
87
  let(:response) { NetSuite::Response.new(:success => true, :body => { :is_person => true }) }
88
88
 
89
89
  it 'returns an CustomerRefund instance populated with the data from the response object' do
90
- NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CustomerRefund, {:external_id => 10}], {}).and_return(response)
90
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CustomerRefund, {:external_id => 10}], {}).and_return(response)
91
91
  refund = NetSuite::Records::CustomerRefund.get(:external_id => 10)
92
- refund.should be_kind_of(NetSuite::Records::CustomerRefund)
92
+ expect(refund).to be_kind_of(NetSuite::Records::CustomerRefund)
93
93
  end
94
94
  end
95
95
 
@@ -97,10 +97,10 @@ describe NetSuite::Records::CustomerRefund do
97
97
  let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
98
98
 
99
99
  it 'raises a RecordNotFound exception' do
100
- NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CustomerRefund, {:external_id => 10}], {}).and_return(response)
101
- lambda {
100
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CustomerRefund, {:external_id => 10}], {}).and_return(response)
101
+ expect {
102
102
  NetSuite::Records::CustomerRefund.get(:external_id => 10)
103
- }.should raise_error(NetSuite::RecordNotFound,
103
+ }.to raise_error(NetSuite::RecordNotFound,
104
104
  /NetSuite::Records::CustomerRefund with OPTIONS=(.*) could not be found/)
105
105
  end
106
106
  end
@@ -109,9 +109,9 @@ describe NetSuite::Records::CustomerRefund do
109
109
  describe '.initialize' do
110
110
  context 'when the request is successful' do
111
111
  it 'returns an initialized invoice from the customer entity' do
112
- NetSuite::Actions::Initialize.should_receive(:call).with([NetSuite::Records::CustomerRefund, memo], {}).and_return(response)
112
+ expect(NetSuite::Actions::Initialize).to receive(:call).with([NetSuite::Records::CustomerRefund, memo], {}).and_return(response)
113
113
  refund = NetSuite::Records::CustomerRefund.initialize(memo)
114
- refund.should be_kind_of(NetSuite::Records::CustomerRefund)
114
+ expect(refund).to be_kind_of(NetSuite::Records::CustomerRefund)
115
115
  end
116
116
  end
117
117
 
@@ -128,10 +128,10 @@ describe NetSuite::Records::CustomerRefund do
128
128
 
129
129
  it 'returns true' do
130
130
  refund = NetSuite::Records::CustomerRefund.new(test_data)
131
- NetSuite::Actions::Add.should_receive(:call).
131
+ expect(NetSuite::Actions::Add).to receive(:call).
132
132
  with([refund], {}).
133
133
  and_return(response)
134
- refund.add.should be_truthy
134
+ expect(refund.add).to be_truthy
135
135
  end
136
136
  end
137
137
 
@@ -140,10 +140,10 @@ describe NetSuite::Records::CustomerRefund do
140
140
 
141
141
  it 'returns false' do
142
142
  refund = NetSuite::Records::CustomerRefund.new(test_data)
143
- NetSuite::Actions::Add.should_receive(:call).
143
+ expect(NetSuite::Actions::Add).to receive(:call).
144
144
  with([refund], {}).
145
145
  and_return(response)
146
- refund.add.should be_falsey
146
+ expect(refund.add).to be_falsey
147
147
  end
148
148
  end
149
149
  end
@@ -154,10 +154,10 @@ describe NetSuite::Records::CustomerRefund do
154
154
 
155
155
  it 'returns true' do
156
156
  refund = NetSuite::Records::CustomerRefund.new
157
- NetSuite::Actions::Delete.should_receive(:call).
157
+ expect(NetSuite::Actions::Delete).to receive(:call).
158
158
  with([refund], {}).
159
159
  and_return(response)
160
- refund.delete.should be_truthy
160
+ expect(refund.delete).to be_truthy
161
161
  end
162
162
  end
163
163
 
@@ -166,10 +166,10 @@ describe NetSuite::Records::CustomerRefund do
166
166
 
167
167
  it 'returns false' do
168
168
  refund = NetSuite::Records::CustomerRefund.new
169
- NetSuite::Actions::Delete.should_receive(:call).
169
+ expect(NetSuite::Actions::Delete).to receive(:call).
170
170
  with([refund], {}).
171
171
  and_return(response)
172
- refund.delete.should be_falsey
172
+ expect(refund.delete).to be_falsey
173
173
  end
174
174
  end
175
175
  end
@@ -184,13 +184,13 @@ describe NetSuite::Records::CustomerRefund do
184
184
  'tranCust:memo' => 'This is a memo',
185
185
  'tranCust:ccZipCode' => '10101'
186
186
  }
187
- refund.to_record.should eql(record)
187
+ expect(refund.to_record).to eql(record)
188
188
  end
189
189
  end
190
190
 
191
191
  describe '#record_type' do
192
192
  it 'returns a string representation of the SOAP type' do
193
- refund.record_type.should eql('tranCust:CustomerRefund')
193
+ expect(refund.record_type).to eql('tranCust:CustomerRefund')
194
194
  end
195
195
  end
196
196