ruby-plsql 0.5.0 → 0.5.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.
@@ -103,15 +103,15 @@ describe "Type" do
103
103
  describe "find" do
104
104
 
105
105
  it "should find existing type" do
106
- PLSQL::Type.find(plsql, :t_employee).should_not be_nil
106
+ expect(PLSQL::Type.find(plsql, :t_employee)).not_to be_nil
107
107
  end
108
108
 
109
109
  it "should not find nonexisting type" do
110
- PLSQL::Type.find(plsql, :qwerty123456).should be_nil
110
+ expect(PLSQL::Type.find(plsql, :qwerty123456)).to be_nil
111
111
  end
112
112
 
113
113
  it "should find existing type in schema" do
114
- plsql.t_employee.should be_a(PLSQL::Type)
114
+ expect(plsql.t_employee).to be_a(PLSQL::Type)
115
115
  end
116
116
 
117
117
  end
@@ -127,11 +127,11 @@ describe "Type" do
127
127
  end
128
128
 
129
129
  it "should find synonym to type" do
130
- PLSQL::Type.find(plsql, :t_employee_synonym).should_not be_nil
130
+ expect(PLSQL::Type.find(plsql, :t_employee_synonym)).not_to be_nil
131
131
  end
132
132
 
133
133
  it "should find type using synonym in schema" do
134
- plsql.t_employee_synonym.should be_a(PLSQL::Type)
134
+ expect(plsql.t_employee_synonym).to be_a(PLSQL::Type)
135
135
  end
136
136
 
137
137
  end
@@ -139,11 +139,11 @@ describe "Type" do
139
139
  describe "public synonym" do
140
140
 
141
141
  it "should find public synonym to type" do
142
- PLSQL::Type.find(plsql, :xmltype).should_not be_nil
142
+ expect(PLSQL::Type.find(plsql, :xmltype)).not_to be_nil
143
143
  end
144
144
 
145
145
  it "should find type using public synonym in schema" do
146
- plsql.xmltype.should be_a(PLSQL::Type)
146
+ expect(plsql.xmltype).to be_a(PLSQL::Type)
147
147
  end
148
148
 
149
149
  end
@@ -151,11 +151,11 @@ describe "Type" do
151
151
  describe "typecode" do
152
152
 
153
153
  it "should get typecode of object type" do
154
- plsql.t_employee.typecode.should == "OBJECT"
154
+ expect(plsql.t_employee.typecode).to eq("OBJECT")
155
155
  end
156
156
 
157
157
  it "should get typecode of collection type" do
158
- plsql.t_phones.typecode.should == "COLLECTION"
158
+ expect(plsql.t_phones.typecode).to eq("COLLECTION")
159
159
  end
160
160
 
161
161
  end
@@ -163,11 +163,11 @@ describe "Type" do
163
163
  describe "attributes" do
164
164
 
165
165
  it "should get attribute names" do
166
- plsql.t_employee.attribute_names.should == [:employee_id, :first_name, :last_name, :hire_date, :address, :phones]
166
+ expect(plsql.t_employee.attribute_names).to eq([:employee_id, :first_name, :last_name, :hire_date, :address, :phones])
167
167
  end
168
168
 
169
169
  it "should get attributes metadata" do
170
- plsql.t_employee.attributes.should == {
170
+ expect(plsql.t_employee.attributes).to eq({
171
171
  :employee_id =>
172
172
  {:position=>1, :data_type=>"NUMBER", :data_length=>nil, :data_precision=>15, :data_scale=>0, :type_owner=>nil, :type_name=>nil, :sql_type_name=>nil},
173
173
  :first_name =>
@@ -180,7 +180,7 @@ describe "Type" do
180
180
  {:position=>5, :data_type=>"OBJECT", :data_length=>nil, :data_precision=>nil, :data_scale=>nil, :type_owner=>"HR", :type_name=>"T_ADDRESS", :sql_type_name=>"HR.T_ADDRESS"},
181
181
  :phones =>
182
182
  {:position=>6, :data_type=>"TABLE", :data_length=>nil, :data_precision=>nil, :data_scale=>nil, :type_owner=>"HR", :type_name=>"T_PHONES", :sql_type_name=>"HR.T_PHONES"}
183
- }
183
+ })
184
184
  end
185
185
 
186
186
  end
@@ -193,37 +193,37 @@ describe "Type" do
193
193
  end
194
194
 
195
195
  it "should get new object instance using named parameters" do
196
- plsql.t_phone(@phone_attributes).should == @phone_attributes
196
+ expect(plsql.t_phone(@phone_attributes)).to eq(@phone_attributes)
197
197
  end
198
198
 
199
199
  it "should be an ObjectInstance" do
200
- plsql.t_phone(@phone_attributes).should be_a(PLSQL::ObjectInstance)
200
+ expect(plsql.t_phone(@phone_attributes)).to be_a(PLSQL::ObjectInstance)
201
201
  end
202
202
 
203
203
  it "should get new object instance using sequential parameters" do
204
- plsql.t_phone(@phone_attributes[:type], @phone_attributes[:phone_number]).should == @phone_attributes
204
+ expect(plsql.t_phone(@phone_attributes[:type], @phone_attributes[:phone_number])).to eq(@phone_attributes)
205
205
  end
206
206
 
207
207
  it "should get new object instance using custom constructor" do
208
- plsql.t_address(@full_address).should == @address_attributes
209
- plsql.t_address(:p_full_address => @full_address).should == @address_attributes
208
+ expect(plsql.t_address(@full_address)).to eq(@address_attributes)
209
+ expect(plsql.t_address(:p_full_address => @full_address)).to eq(@address_attributes)
210
210
  end
211
211
 
212
212
  it "should get new object instance using default constructor when custom constructor exists" do
213
- plsql.t_address(@address_attributes).should == @address_attributes
214
- plsql.t_address(@address_attributes[:street], @address_attributes[:city], @address_attributes[:country]).should == @address_attributes
213
+ expect(plsql.t_address(@address_attributes)).to eq(@address_attributes)
214
+ expect(plsql.t_address(@address_attributes[:street], @address_attributes[:city], @address_attributes[:country])).to eq(@address_attributes)
215
215
  end
216
216
 
217
217
  it "should get new empty collection of objects instance" do
218
- plsql.t_phones.new.should == []
219
- plsql.t_phones([]).should == []
218
+ expect(plsql.t_phones.new).to eq([])
219
+ expect(plsql.t_phones([])).to eq([])
220
220
  end
221
221
 
222
222
  it "should get new collection of objects instances" do
223
223
  phone = plsql.t_phone(@phone_attributes)
224
- plsql.t_phones([phone, phone]).should == [phone, phone]
225
- plsql.t_phones(phone, phone).should == [phone, phone]
226
- plsql.t_phones(@phone_attributes, @phone_attributes).should == [phone, phone]
224
+ expect(plsql.t_phones([phone, phone])).to eq([phone, phone])
225
+ expect(plsql.t_phones(phone, phone)).to eq([phone, phone])
226
+ expect(plsql.t_phones(@phone_attributes, @phone_attributes)).to eq([phone, phone])
227
227
  end
228
228
 
229
229
  end
@@ -235,46 +235,47 @@ describe "Type" do
235
235
  end
236
236
 
237
237
  it "should call object instance member function without parameters" do
238
- plsql.t_address(@address_attributes).display_address.should == @full_address
238
+ expect(plsql.t_address(@address_attributes).display_address).to eq(@full_address)
239
239
  end
240
240
 
241
241
  it "should call object instance member function with parameters" do
242
- plsql.t_address(@address_attributes).display_address(',').should == @full_address
242
+ expect(plsql.t_address(@address_attributes).display_address(',')).to eq(@full_address)
243
243
  end
244
244
 
245
245
  it "should call object instance member function with named parameters" do
246
- plsql.t_address(@address_attributes).display_address(:p_separator => ',').should == @full_address
246
+ expect(plsql.t_address(@address_attributes).display_address(:p_separator => ',')).to eq(@full_address)
247
247
  end
248
248
 
249
249
  it "should call object overloaded instance member function" do
250
- plsql.t_address(@address_attributes).display_address(true).should == @full_address.upcase
251
- plsql.t_address(@address_attributes).display_address(true, ',').should == @full_address.upcase
250
+ expect(plsql.t_address(@address_attributes).display_address(true)).to eq(@full_address.upcase)
251
+ expect(plsql.t_address(@address_attributes).display_address(true, ',')).to eq(@full_address.upcase)
252
252
  end
253
253
 
254
254
  it "should call object instance member function with explicit first SELF parameter" do
255
- plsql.t_address.display_address(@address_attributes, ',').should == @full_address
255
+ expect(plsql.t_address.display_address(@address_attributes, ',')).to eq(@full_address)
256
256
  end
257
257
 
258
258
  it "should call object instance member function with explicit named SELF parameter" do
259
- plsql.t_address.display_address(:self => @address_attributes, :p_separator => ',').should == @full_address
259
+ expect(plsql.t_address.display_address(:self => @address_attributes, :p_separator => ',')).to eq(@full_address)
260
260
  end
261
261
 
262
262
  it "should call object instance member procedure" do
263
263
  other_country = "Other"
264
- plsql.t_address(@address_attributes).set_country(other_country).should == @address_attributes.merge(:country => other_country)
264
+ expect(plsql.t_address(@address_attributes).set_country(other_country)).to eq(@address_attributes.merge(:country => other_country))
265
265
  end
266
266
 
267
267
  it "should call object instance member procedure with output parameters" do
268
268
  other_country = "Other"
269
- plsql.t_address(@address_attributes).set_country2(other_country).should ==
269
+ expect(plsql.t_address(@address_attributes).set_country2(other_country)).to eq(
270
270
  [@address_attributes.merge(:country => other_country),
271
271
  {:x_display_address => "#{@address_attributes[:street]}, #{@address_attributes[:city]}, #{other_country}"}]
272
+ )
272
273
  end
273
274
 
274
275
  it "should raise error if invalid member procedure is called" do
275
- lambda do
276
+ expect do
276
277
  plsql.t_address(@address_attributes).invalid_procedure
277
- end.should raise_error(ArgumentError)
278
+ end.to raise_error(ArgumentError)
278
279
  end
279
280
 
280
281
  end
@@ -286,17 +287,17 @@ describe "Type" do
286
287
  end
287
288
 
288
289
  it "should call object type static function" do
289
- plsql.t_address.create_address(@full_address).should == @address_attributes
290
+ expect(plsql.t_address.create_address(@full_address)).to eq(@address_attributes)
290
291
  end
291
292
 
292
293
  it "should call object type static function with named parameters" do
293
- plsql.t_address.create_address(:p_full_address => @full_address).should == @address_attributes
294
+ expect(plsql.t_address.create_address(:p_full_address => @full_address)).to eq(@address_attributes)
294
295
  end
295
296
 
296
297
  it "should raise error if invalid static procedure is called" do
297
- lambda do
298
+ expect do
298
299
  plsql.t_address.invalid_procedure
299
- end.should raise_error(ArgumentError)
300
+ end.to raise_error(ArgumentError)
300
301
  end
301
302
 
302
303
  end
@@ -35,18 +35,18 @@ describe "Package variables /" do
35
35
 
36
36
  it "should set and get VARCHAR2 variable" do
37
37
  plsql.test_package.varchar2_variable = 'abc'
38
- plsql.test_package.varchar2_variable.should == 'abc'
38
+ expect(plsql.test_package.varchar2_variable).to eq('abc')
39
39
  end
40
40
 
41
41
  it "should set and get VARCHAR2 variable with comment" do
42
42
  plsql.test_package.varchar2_variable2 = 'abc'
43
- plsql.test_package.varchar2_variable2.should == 'abc'
43
+ expect(plsql.test_package.varchar2_variable2).to eq('abc')
44
44
  end
45
45
 
46
46
  it "should get VARCHAR2 variable default value" do
47
- plsql.test_package.varchar2_default.should == 'default'
48
- plsql.test_package.varchar2_default2.should == 'default'
49
- plsql.test_package.varchar2_default3.should == 'default'
47
+ expect(plsql.test_package.varchar2_default).to eq('default')
48
+ expect(plsql.test_package.varchar2_default2).to eq('default')
49
+ expect(plsql.test_package.varchar2_default3).to eq('default')
50
50
  end
51
51
 
52
52
  describe "with character or byte limit" do
@@ -65,32 +65,32 @@ describe "Package variables /" do
65
65
 
66
66
  it "should set and get VARCHAR2(n CHAR) variable" do
67
67
  plsql.test_package.varchar2_3_char = 'āčē'
68
- plsql.test_package.varchar2_3_char.should == 'āčē'
69
- lambda { plsql.test_package.varchar2_3_char = 'aceg' }.should raise_error(/buffer too small/)
68
+ expect(plsql.test_package.varchar2_3_char).to eq('āčē')
69
+ expect { plsql.test_package.varchar2_3_char = 'aceg' }.to raise_error(/buffer too small/)
70
70
  end
71
71
 
72
72
  it "should set and get VARCHAR2(n BYTE) variable" do
73
73
  plsql.test_package.varchar2_3_byte = 'ace'
74
- plsql.test_package.varchar2_3_byte.should == 'ace'
75
- lambda { plsql.test_package.varchar2_3_byte = 'āce' }.should raise_error(/buffer too small/)
76
- lambda { plsql.test_package.varchar2_3_byte = 'aceg' }.should raise_error(/buffer too small/)
74
+ expect(plsql.test_package.varchar2_3_byte).to eq('ace')
75
+ expect { plsql.test_package.varchar2_3_byte = 'āce' }.to raise_error(/buffer too small/)
76
+ expect { plsql.test_package.varchar2_3_byte = 'aceg' }.to raise_error(/buffer too small/)
77
77
  end
78
78
 
79
79
  end
80
80
 
81
81
  it "should set and get CHAR variable" do
82
82
  plsql.test_package.char_variable = 'abc'
83
- plsql.test_package.char_variable.should == 'abc' + ' '*7
83
+ expect(plsql.test_package.char_variable).to eq('abc' + ' '*7)
84
84
  end
85
85
 
86
86
  it "should set and get NVARCHAR2 variable" do
87
87
  plsql.test_package.nvarchar2_variable = 'abc'
88
- plsql.test_package.nvarchar2_variable.should == 'abc'
88
+ expect(plsql.test_package.nvarchar2_variable).to eq('abc')
89
89
  end
90
90
 
91
91
  it "should set and get NCHAR variable" do
92
92
  plsql.test_package.nchar_variable = 'abc'
93
- plsql.test_package.nchar_variable.should == 'abc' + ' '*7
93
+ expect(plsql.test_package.nchar_variable).to eq('abc' + ' '*7)
94
94
  end
95
95
 
96
96
  end
@@ -123,41 +123,41 @@ describe "Package variables /" do
123
123
 
124
124
  it "should set and get INTEGER variable" do
125
125
  plsql.test_package.integer_variable = 1
126
- plsql.test_package.integer_variable.should be_a Fixnum
127
- plsql.test_package.integer_variable.should == 1
126
+ expect(plsql.test_package.integer_variable).to be_a Fixnum
127
+ expect(plsql.test_package.integer_variable).to eq(1)
128
128
  end
129
129
 
130
130
  it "should set and get integer variable with precision" do
131
131
  plsql.test_package.integer10_variable = 1
132
- plsql.test_package.integer10_variable.should be_a Fixnum
133
- plsql.test_package.integer10_variable.should == 1
132
+ expect(plsql.test_package.integer10_variable).to be_a Fixnum
133
+ expect(plsql.test_package.integer10_variable).to eq(1)
134
134
  end
135
135
 
136
136
  it "should get integer variable default value" do
137
- plsql.test_package.integer10_default.should == 1
137
+ expect(plsql.test_package.integer10_default).to eq(1)
138
138
  end
139
139
 
140
140
  it "should set and get PLS_INTEGER variable" do
141
141
  plsql.test_package.pls_int_variable = 1
142
- plsql.test_package.pls_int_variable.should be_a Fixnum
143
- plsql.test_package.pls_int_variable.should == 1
142
+ expect(plsql.test_package.pls_int_variable).to be_a Fixnum
143
+ expect(plsql.test_package.pls_int_variable).to eq(1)
144
144
  end
145
145
 
146
146
  it "should set and get BINARY_INTEGER variable" do
147
147
  plsql.test_package.bin_int_variable = 1
148
- plsql.test_package.bin_int_variable.should be_a Fixnum
149
- plsql.test_package.bin_int_variable.should == 1
148
+ expect(plsql.test_package.bin_int_variable).to be_a Fixnum
149
+ expect(plsql.test_package.bin_int_variable).to eq(1)
150
150
  end
151
151
 
152
152
  it "should set and get NUMBER variable" do
153
153
  plsql.test_package.number_variable = 123.456
154
- plsql.test_package.number_variable.should be_a BigDecimal
155
- plsql.test_package.number_variable.should == 123.456
154
+ expect(plsql.test_package.number_variable).to be_a BigDecimal
155
+ expect(plsql.test_package.number_variable).to eq(123.456)
156
156
  end
157
157
 
158
158
  it "should set and get NUMBER variable with scale" do
159
159
  plsql.test_package.number_with_scale = 123.456
160
- plsql.test_package.number_with_scale.should == 123.46 # rounding to two decimal digits
160
+ expect(plsql.test_package.number_with_scale).to eq(123.46) # rounding to two decimal digits
161
161
  end
162
162
 
163
163
  end
@@ -189,30 +189,30 @@ describe "Package variables /" do
189
189
 
190
190
  it "should set and get DATE variable" do
191
191
  plsql.test_package.date_variable = @date
192
- plsql.test_package.date_variable.should be_a Time
193
- plsql.test_package.date_variable.should == @date
192
+ expect(plsql.test_package.date_variable).to be_a Time
193
+ expect(plsql.test_package.date_variable).to eq(@date)
194
194
  end
195
195
 
196
196
  it "should get DATE variable default value" do
197
- plsql.test_package.date_default.should == @date
197
+ expect(plsql.test_package.date_default).to eq(@date)
198
198
  end
199
199
 
200
200
  it "should set and get TIMESTAMP variable" do
201
201
  plsql.test_package.timestamp_variable = @timestamp
202
- plsql.test_package.timestamp_variable.should be_a Time
203
- plsql.test_package.timestamp_variable.should == @timestamp
202
+ expect(plsql.test_package.timestamp_variable).to be_a Time
203
+ expect(plsql.test_package.timestamp_variable).to eq(@timestamp)
204
204
  end
205
205
 
206
206
  it "should set and get TIMESTAMP WITH TIME ZONE variable" do
207
207
  plsql.test_package.timestamptz_variable = @timestamp
208
- plsql.test_package.timestamptz_variable.should be_a Time
209
- plsql.test_package.timestamptz_variable.should == @timestamp
208
+ expect(plsql.test_package.timestamptz_variable).to be_a Time
209
+ expect(plsql.test_package.timestamptz_variable).to eq(@timestamp)
210
210
  end
211
211
 
212
212
  it "should set and get TIMESTAMP WITH LOCAL TIME ZONE variable" do
213
213
  plsql.test_package.timestampltz_variable = @timestamp
214
- plsql.test_package.timestampltz_variable.should be_a Time
215
- plsql.test_package.timestampltz_variable.should == @timestamp
214
+ expect(plsql.test_package.timestampltz_variable).to be_a Time
215
+ expect(plsql.test_package.timestampltz_variable).to eq(@timestamp)
216
216
  end
217
217
 
218
218
  end
@@ -242,21 +242,21 @@ describe "Package variables /" do
242
242
 
243
243
  it "should set and get CLOB variable" do
244
244
  plsql.test_package.clob_variable = 'abc'
245
- plsql.test_package.clob_variable.should == 'abc'
245
+ expect(plsql.test_package.clob_variable).to eq('abc')
246
246
  end
247
247
 
248
248
  it "should get CLOB variable default value" do
249
- plsql.test_package.clob_default.should == 'default'
249
+ expect(plsql.test_package.clob_default).to eq('default')
250
250
  end
251
251
 
252
252
  it "should set and get NCLOB variable" do
253
253
  plsql.test_package.nclob_variable = 'abc'
254
- plsql.test_package.nclob_variable.should == 'abc'
254
+ expect(plsql.test_package.nclob_variable).to eq('abc')
255
255
  end
256
256
 
257
257
  it "should set and get BLOB variable" do
258
258
  plsql.test_package.blob_variable = "\000\001\003"
259
- plsql.test_package.blob_variable.should == "\000\001\003"
259
+ expect(plsql.test_package.blob_variable).to eq("\000\001\003")
260
260
  end
261
261
 
262
262
  end
@@ -295,18 +295,18 @@ describe "Package variables /" do
295
295
 
296
296
  it "should set and get NUMBER variable" do
297
297
  plsql.test_package.employee_id = 1
298
- plsql.test_package.employee_id.should == 1
298
+ expect(plsql.test_package.employee_id).to eq(1)
299
299
  end
300
300
 
301
301
  it "should set and get VARCHAR2 variable" do
302
302
  plsql.test_package.first_name = 'First'
303
- plsql.test_package.first_name.should == 'First'
303
+ expect(plsql.test_package.first_name).to eq('First')
304
304
  end
305
305
 
306
306
  it "should set and get DATE variable" do
307
307
  today = Time.local(2009,12,22)
308
308
  plsql.test_package.hire_date = today
309
- plsql.test_package.hire_date.should == today
309
+ expect(plsql.test_package.hire_date).to eq(today)
310
310
  end
311
311
 
312
312
  end
@@ -333,17 +333,17 @@ describe "Package variables /" do
333
333
  end
334
334
 
335
335
  it "should get NUMBER constant" do
336
- plsql.test_package.integer_constant.should == 1
336
+ expect(plsql.test_package.integer_constant).to eq(1)
337
337
  end
338
338
 
339
339
  it "should get VARCHAR2 constant" do
340
- plsql.test_package.string_constant.should == 'constant'
340
+ expect(plsql.test_package.string_constant).to eq('constant')
341
341
  end
342
342
 
343
343
  it "should raise error when trying to set constant" do
344
- lambda {
344
+ expect {
345
345
  plsql.test_package.integer_constant = 2
346
- }.should raise_error(/PLS-00363/)
346
+ }.to raise_error(/PLS-00363/)
347
347
  end
348
348
 
349
349
  end
@@ -414,17 +414,17 @@ describe "Package variables /" do
414
414
 
415
415
  it "should set and get object type variable" do
416
416
  plsql.test_package.g_employee = @employee
417
- plsql.test_package.g_employee.should == @employee
417
+ expect(plsql.test_package.g_employee).to eq(@employee)
418
418
  end
419
419
 
420
420
  it "should set and get object type variable when schema prefix is used with type" do
421
421
  plsql.hr.test_package.g_employee2 = @employee
422
- plsql.hr.test_package.g_employee2.should == @employee
422
+ expect(plsql.hr.test_package.g_employee2).to eq(@employee)
423
423
  end
424
424
 
425
425
  it "should set and get collection type variable" do
426
426
  plsql.test_package.g_phones = @phones
427
- plsql.test_package.g_phones.should == @phones
427
+ expect(plsql.test_package.g_phones).to eq(@phones)
428
428
  end
429
429
 
430
430
  end
@@ -467,7 +467,7 @@ describe "Package variables /" do
467
467
 
468
468
  it "should set and get table ROWTYPE variable" do
469
469
  plsql.test_package.g_employee = @employee
470
- plsql.test_package.g_employee.should == @employee
470
+ expect(plsql.test_package.g_employee).to eq(@employee)
471
471
  end
472
472
 
473
473
  end
@@ -493,11 +493,11 @@ describe "Package variables /" do
493
493
  end
494
494
 
495
495
  it "should set and get BOOLEAN variable" do
496
- plsql.test_package.boolean_variable.should be_nil
496
+ expect(plsql.test_package.boolean_variable).to be_nil
497
497
  plsql.test_package.boolean_variable = true
498
- plsql.test_package.boolean_variable.should be_true
498
+ expect(plsql.test_package.boolean_variable).to be_truthy
499
499
  plsql.test_package.boolean_variable = false
500
- plsql.test_package.boolean_variable.should be_false
500
+ expect(plsql.test_package.boolean_variable).to be_falsey
501
501
  end
502
502
 
503
503
  end