activerecord-oracle_enhanced-adapter 1.7.11 → 1.8.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -0
  3. data/Gemfile +20 -11
  4. data/History.md +123 -4
  5. data/RUNNING_TESTS.md +79 -55
  6. data/Rakefile +13 -19
  7. data/VERSION +1 -1
  8. data/activerecord-oracle_enhanced-adapter.gemspec +16 -17
  9. data/lib/active_record/connection_adapters/emulation/oracle_adapter.rb +1 -1
  10. data/lib/active_record/connection_adapters/oracle_enhanced/column.rb +7 -59
  11. data/lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb +6 -50
  12. data/lib/active_record/connection_adapters/oracle_enhanced/connection.rb +11 -11
  13. data/lib/active_record/connection_adapters/oracle_enhanced/context_index.rb +117 -117
  14. data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +30 -23
  15. data/lib/active_record/connection_adapters/oracle_enhanced/database_tasks.rb +10 -10
  16. data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb +48 -70
  17. data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb +1 -4
  18. data/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb +51 -69
  19. data/lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb +4 -4
  20. data/lib/active_record/connection_adapters/oracle_enhanced/procedures.rb +76 -76
  21. data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +13 -42
  22. data/lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb +60 -64
  23. data/lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb +33 -47
  24. data/lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb +146 -159
  25. data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +94 -132
  26. data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb +3 -3
  27. data/lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb +65 -100
  28. data/lib/active_record/connection_adapters/oracle_enhanced/version.rb +1 -1
  29. data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +250 -487
  30. data/lib/active_record/oracle_enhanced/type/boolean.rb +7 -10
  31. data/lib/active_record/oracle_enhanced/type/integer.rb +3 -4
  32. data/lib/active_record/oracle_enhanced/type/national_character_string.rb +1 -1
  33. data/lib/active_record/oracle_enhanced/type/raw.rb +2 -3
  34. data/lib/active_record/oracle_enhanced/type/string.rb +2 -2
  35. data/lib/active_record/oracle_enhanced/type/text.rb +2 -2
  36. data/lib/activerecord-oracle_enhanced-adapter.rb +2 -2
  37. data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +57 -131
  38. data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +32 -34
  39. data/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +40 -42
  40. data/spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb +83 -85
  41. data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +205 -286
  42. data/spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb +14 -6
  43. data/spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb +3 -5
  44. data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +42 -49
  45. data/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb +1 -3
  46. data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +68 -71
  47. data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +51 -92
  48. data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +221 -327
  49. data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +16 -18
  50. data/spec/spec_helper.rb +59 -57
  51. metadata +10 -10
@@ -1,13 +1,12 @@
1
- require 'spec_helper'
2
- require 'active_record/connection_adapters/oracle_enhanced/database_tasks'
3
- require 'stringio'
4
- require 'tempfile'
1
+ require "active_record/connection_adapters/oracle_enhanced/database_tasks"
2
+ require "stringio"
3
+ require "tempfile"
5
4
 
6
5
  describe "Oracle Enhanced adapter database tasks" do
7
6
  let(:config) { CONNECTION_PARAMS.with_indifferent_access }
8
7
 
9
8
  describe "create" do
10
- let(:new_user_config) { config.merge({username: "oracle_enhanced_test_user"}) }
9
+ let(:new_user_config) { config.merge(username: "oracle_enhanced_test_user") }
11
10
  before do
12
11
  fake_terminal(SYSTEM_CONNECTION_PARAMS[:password]) do
13
12
  ActiveRecord::Tasks::DatabaseTasks.create(new_user_config)
@@ -34,6 +33,15 @@ describe "Oracle Enhanced adapter database tasks" do
34
33
  end
35
34
 
36
35
  context "with test table" do
36
+ before(:all) do
37
+ $stdout, @original_stdout = StringIO.new, $stdout
38
+ $stderr, @original_stderr = StringIO.new, $stderr
39
+ end
40
+
41
+ after(:all) do
42
+ $stdout, $stderr = @original_stdout, @original_stderr
43
+ end
44
+
37
45
  before do
38
46
  ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
39
47
  ActiveRecord::Base.connection.execute "CREATE TABLE test_posts (name VARCHAR2(20))"
@@ -66,7 +74,7 @@ describe "Oracle Enhanced adapter database tasks" do
66
74
  it "dumps the database structure to a file without the schema information" do
67
75
  contents = File.read(temp_file)
68
76
  expect(contents).to include('CREATE TABLE "TEST_POSTS"')
69
- expect(contents).not_to include('INSERT INTO schema_migrations')
77
+ expect(contents).not_to include("INSERT INTO schema_migrations")
70
78
  end
71
79
  end
72
80
 
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe "OracleEnhancedAdapter logging dbms_output from plsql" do
4
2
  include LoggerSpecHelper
5
3
 
@@ -42,7 +40,7 @@ describe "OracleEnhancedAdapter logging dbms_output from plsql" do
42
40
  it "should NOT log dbms output when dbms output is disabled" do
43
41
  @conn.disable_dbms_output
44
42
 
45
- expect(@conn.select_all("select more_than_five_characters_long('hi there') is_it_long from dual").to_a).to eq([{'is_it_long'=>1}])
43
+ expect(@conn.select_all("select more_than_five_characters_long('hi there') is_it_long from dual").to_a).to eq([{ "is_it_long" => 1 }])
46
44
 
47
45
  expect(@logger.output(:debug)).not_to match(/^DBMS_OUTPUT/)
48
46
  end
@@ -50,7 +48,7 @@ describe "OracleEnhancedAdapter logging dbms_output from plsql" do
50
48
  it "should log dbms output lines to the rails log" do
51
49
  @conn.enable_dbms_output
52
50
 
53
- expect(@conn.select_all("select more_than_five_characters_long('hi there') is_it_long from dual").to_a).to eq([{'is_it_long'=>1}])
51
+ expect(@conn.select_all("select more_than_five_characters_long('hi there') is_it_long from dual").to_a).to eq([{ "is_it_long" => 1 }])
54
52
 
55
53
  expect(@logger.output(:debug)).to match(/^DBMS_OUTPUT: before the if -hi there-$/)
56
54
  expect(@logger.output(:debug)).to match(/^DBMS_OUTPUT: it is longer than 5$/)
@@ -60,7 +58,7 @@ describe "OracleEnhancedAdapter logging dbms_output from plsql" do
60
58
  it "should log dbms output lines to the rails log" do
61
59
  @conn.enable_dbms_output
62
60
 
63
- expect(@conn.select_all("select more_than_five_characters_long('short') is_it_long from dual").to_a).to eq([{'is_it_long'=>0}])
61
+ expect(@conn.select_all("select more_than_five_characters_long('short') is_it_long from dual").to_a).to eq([{ "is_it_long" => 0 }])
64
62
 
65
63
  expect(@logger.output(:debug)).to match(/^DBMS_OUTPUT: before the if -short-$/)
66
64
  expect(@logger.output(:debug)).to match(/^DBMS_OUTPUT: it is 5 or shorter$/)
@@ -1,69 +1,62 @@
1
- require 'spec_helper'
2
-
3
1
  if ActiveRecord::Base.method_defined?(:changed?)
4
2
 
5
3
  describe "OracleEnhancedAdapter dirty object tracking" do
4
+ include SchemaSpecHelper
6
5
 
7
6
  before(:all) do
8
7
  ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
9
- @conn = ActiveRecord::Base.connection
10
- @conn.execute "DROP TABLE test_employees" rescue nil
11
- @conn.execute "DROP SEQUENCE test_employees_seq" rescue nil
12
- @conn.execute <<-SQL
13
- CREATE TABLE test_employees (
14
- id NUMBER PRIMARY KEY,
15
- first_name VARCHAR2(20),
16
- last_name VARCHAR2(25),
17
- job_id NUMBER(6,0) NULL,
18
- salary NUMBER(8,2),
19
- comments CLOB,
20
- hire_date DATE
21
- )
22
- SQL
23
- @conn.execute <<-SQL
24
- CREATE SEQUENCE test_employees_seq MINVALUE 1
25
- INCREMENT BY 1 CACHE 20 NOORDER NOCYCLE
26
- SQL
8
+ schema_define do
9
+ create_table :test_employees, force: true do |t|
10
+ t.string :first_name, limit: 20
11
+ t.string :last_name, limit: 25
12
+ t.integer :job_id, limit: 6, null: true
13
+ t.decimal :salary, precision: 8, scale: 2
14
+ t.text :comments
15
+ t.date :hire_date
16
+ end
17
+ end
18
+
27
19
  class TestEmployee < ActiveRecord::Base
28
20
  end
29
21
  end
30
22
 
31
23
  after(:all) do
24
+ schema_define do
25
+ drop_table :test_employees
26
+ end
32
27
  Object.send(:remove_const, "TestEmployee")
33
- @conn.execute "DROP TABLE test_employees"
34
- @conn.execute "DROP SEQUENCE test_employees_seq"
35
- ActiveRecord::Base.clear_cache! if ActiveRecord::Base.respond_to?(:"clear_cache!")
28
+ ActiveRecord::Base.clear_cache!
36
29
  end
37
30
 
38
31
  it "should not mark empty string (stored as NULL) as changed when reassigning it" do
39
- @employee = TestEmployee.create!(:first_name => '')
40
- @employee.first_name = ''
32
+ @employee = TestEmployee.create!(first_name: "")
33
+ @employee.first_name = ""
41
34
  expect(@employee).not_to be_changed
42
35
  @employee.reload
43
- @employee.first_name = ''
36
+ @employee.first_name = ""
44
37
  expect(@employee).not_to be_changed
45
38
  end
46
39
 
47
40
  it "should not mark empty integer (stored as NULL) as changed when reassigning it" do
48
- @employee = TestEmployee.create!(:job_id => '')
49
- @employee.job_id = ''
41
+ @employee = TestEmployee.create!(job_id: "")
42
+ @employee.job_id = ""
50
43
  expect(@employee).not_to be_changed
51
44
  @employee.reload
52
- @employee.job_id = ''
45
+ @employee.job_id = ""
53
46
  expect(@employee).not_to be_changed
54
47
  end
55
48
 
56
49
  it "should not mark empty decimal (stored as NULL) as changed when reassigning it" do
57
- @employee = TestEmployee.create!(:salary => '')
58
- @employee.salary = ''
50
+ @employee = TestEmployee.create!(salary: "")
51
+ @employee.salary = ""
59
52
  expect(@employee).not_to be_changed
60
53
  @employee.reload
61
- @employee.salary = ''
54
+ @employee.salary = ""
62
55
  expect(@employee).not_to be_changed
63
56
  end
64
57
 
65
58
  it "should not mark empty text (stored as NULL) as changed when reassigning it" do
66
- @employee = TestEmployee.create!(:comments => nil)
59
+ @employee = TestEmployee.create!(comments: nil)
67
60
  @employee.comments = nil
68
61
  expect(@employee).not_to be_changed
69
62
  @employee.reload
@@ -72,16 +65,16 @@ if ActiveRecord::Base.method_defined?(:changed?)
72
65
  end
73
66
 
74
67
  it "should not mark empty text (stored as empty_clob()) as changed when reassigning it" do
75
- @employee = TestEmployee.create!(:comments => '')
76
- @employee.comments = ''
68
+ @employee = TestEmployee.create!(comments: "")
69
+ @employee.comments = ""
77
70
  expect(@employee).not_to be_changed
78
71
  @employee.reload
79
- @employee.comments = ''
72
+ @employee.comments = ""
80
73
  expect(@employee).not_to be_changed
81
74
  end
82
75
 
83
76
  it "should mark empty text (stored as empty_clob()) as changed when assigning nil to it" do
84
- @employee = TestEmployee.create!(:comments => '')
77
+ @employee = TestEmployee.create!(comments: "")
85
78
  @employee.comments = nil
86
79
  expect(@employee).to be_changed
87
80
  @employee.reload
@@ -90,20 +83,20 @@ if ActiveRecord::Base.method_defined?(:changed?)
90
83
  end
91
84
 
92
85
  it "should mark empty text (stored as NULL) as changed when assigning '' to it" do
93
- @employee = TestEmployee.create!(:comments => nil)
94
- @employee.comments = ''
86
+ @employee = TestEmployee.create!(comments: nil)
87
+ @employee.comments = ""
95
88
  expect(@employee).to be_changed
96
89
  @employee.reload
97
- @employee.comments = ''
90
+ @employee.comments = ""
98
91
  expect(@employee).to be_changed
99
92
  end
100
93
 
101
94
  it "should not mark empty date (stored as NULL) as changed when reassigning it" do
102
- @employee = TestEmployee.create!(:hire_date => '')
103
- @employee.hire_date = ''
95
+ @employee = TestEmployee.create!(hire_date: "")
96
+ @employee.hire_date = ""
104
97
  expect(@employee).not_to be_changed
105
98
  @employee.reload
106
- @employee.hire_date = ''
99
+ @employee.hire_date = ""
107
100
  expect(@employee).not_to be_changed
108
101
  end
109
102
 
@@ -114,30 +107,30 @@ if ActiveRecord::Base.method_defined?(:changed?)
114
107
 
115
108
  expect(@employee).not_to be_changed
116
109
 
117
- @employee.job_id = '0'
110
+ @employee.job_id = "0"
118
111
  expect(@employee).not_to be_changed
119
112
  end
120
113
 
121
114
  it "should not update unchanged CLOBs" do
122
115
  @employee = TestEmployee.create!(
123
- :comments => "initial"
116
+ comments: "initial"
124
117
  )
125
118
  expect(@employee.save!).to be_truthy
126
119
  @employee.reload
127
- expect(@employee.comments).to eq('initial')
120
+ expect(@employee.comments).to eq("initial")
128
121
 
129
- oci_conn = @conn.instance_variable_get('@connection')
122
+ oci_conn = @conn.instance_variable_get("@connection")
130
123
  class << oci_conn
131
124
  def write_lob(lob, value, is_binary = false); raise "don't do this'"; end
132
125
  end
133
- expect{@employee.save!}.not_to raise_exception(RuntimeError, "don't do this'")
126
+ expect { @employee.save! }.not_to raise_exception(RuntimeError, "don't do this'")
134
127
  class << oci_conn
135
128
  remove_method :write_lob
136
129
  end
137
130
  end
138
131
 
139
132
  it "should be able to handle attributes which are not backed by a column" do
140
- TestEmployee.create!(:comments => "initial")
133
+ TestEmployee.create!(comments: "initial")
141
134
  @employee = TestEmployee.select("#{TestEmployee.quoted_table_name}.*, 24 ranking").first
142
135
  expect { @employee.ranking = 25 }.to_not raise_error
143
136
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe "OracleEnhancedAdapter emulate OracleAdapter" do
4
2
 
5
3
  before(:all) do
@@ -10,7 +8,7 @@ describe "OracleEnhancedAdapter emulate OracleAdapter" do
10
8
  end
11
9
 
12
10
  it "should be an OracleAdapter" do
13
- @conn = ActiveRecord::Base.establish_connection(CONNECTION_PARAMS.merge(:emulate_oracle_adapter => true))
11
+ @conn = ActiveRecord::Base.establish_connection(CONNECTION_PARAMS.merge(emulate_oracle_adapter: true))
14
12
  expect(ActiveRecord::Base.connection).not_to be_nil
15
13
  expect(ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::OracleAdapter)).to be_truthy
16
14
  end
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- require 'ruby-plsql'
1
+ require "ruby-plsql"
4
2
 
5
3
  describe "OracleEnhancedAdapter custom methods for create, update and destroy" do
6
4
  include LoggerSpecHelper
@@ -95,7 +93,6 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
95
93
  END;
96
94
  SQL
97
95
 
98
- ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = true
99
96
  end
100
97
 
101
98
  after(:all) do
@@ -115,55 +112,55 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
115
112
  # should return ID of new record
116
113
  set_create_method do
117
114
  plsql.test_employees_pkg.create_employee(
118
- :p_first_name => first_name,
119
- :p_last_name => last_name,
120
- :p_hire_date => hire_date,
121
- :p_salary => salary,
122
- :p_description => "#{first_name} #{last_name}",
123
- :p_employee_id => nil
115
+ p_first_name: first_name,
116
+ p_last_name: last_name,
117
+ p_hire_date: hire_date,
118
+ p_salary: salary,
119
+ p_description: "#{first_name} #{last_name}",
120
+ p_employee_id: nil
124
121
  )[:p_employee_id]
125
122
  end
126
123
 
127
124
  # return value is ignored
128
125
  set_update_method do
129
126
  plsql.test_employees_pkg.update_employee(
130
- :p_employee_id => id,
131
- :p_first_name => first_name,
132
- :p_last_name => last_name,
133
- :p_hire_date => hire_date,
134
- :p_salary => salary,
135
- :p_description => "#{first_name} #{last_name}"
127
+ p_employee_id: id,
128
+ p_first_name: first_name,
129
+ p_last_name: last_name,
130
+ p_hire_date: hire_date,
131
+ p_salary: salary,
132
+ p_description: "#{first_name} #{last_name}"
136
133
  )
137
134
  end
138
135
 
139
136
  # return value is ignored
140
137
  set_delete_method do
141
138
  plsql.test_employees_pkg.delete_employee(
142
- :p_employee_id => id
139
+ p_employee_id: id
143
140
  )
144
141
  end
145
142
 
146
143
  private
147
144
 
148
- def raise_make_transaction_rollback
149
- raise "Make the transaction rollback"
150
- end
145
+ def raise_make_transaction_rollback
146
+ raise "Make the transaction rollback"
147
+ end
151
148
  end
152
149
 
153
- @today = Date.new(2008,6,28)
150
+ @today = Date.new(2008, 6, 28)
154
151
  @buffer = StringIO.new
155
152
  end
156
153
 
157
154
  after(:each) do
158
155
  Object.send(:remove_const, "TestEmployee")
159
- ActiveRecord::Base.clear_cache! if ActiveRecord::Base.respond_to?(:"clear_cache!")
156
+ ActiveRecord::Base.clear_cache!
160
157
  end
161
158
 
162
159
  it "should create record" do
163
160
  @employee = TestEmployee.create(
164
- :first_name => "First",
165
- :last_name => "Last",
166
- :hire_date => @today
161
+ first_name: "First",
162
+ last_name: "Last",
163
+ hire_date: @today
167
164
  )
168
165
  @employee.reload
169
166
  expect(@employee.first_name).to eq("First")
@@ -178,9 +175,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
178
175
  TestEmployee.after_create :raise_make_transaction_rollback
179
176
 
180
177
  @employee = TestEmployee.new(
181
- :first_name => "First",
182
- :last_name => "Last",
183
- :hire_date => @today
178
+ first_name: "First",
179
+ last_name: "Last",
180
+ hire_date: @today
184
181
  )
185
182
  employees_count = TestEmployee.count
186
183
  expect {
@@ -192,10 +189,10 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
192
189
 
193
190
  it "should update record" do
194
191
  @employee = TestEmployee.create(
195
- :first_name => "First",
196
- :last_name => "Last",
197
- :hire_date => @today,
198
- :description => "description"
192
+ first_name: "First",
193
+ last_name: "Last",
194
+ hire_date: @today,
195
+ description: "description"
199
196
  )
200
197
  @employee.reload
201
198
  @employee.first_name = "Second"
@@ -208,10 +205,10 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
208
205
  TestEmployee.after_update :raise_make_transaction_rollback
209
206
 
210
207
  @employee = TestEmployee.create(
211
- :first_name => "First",
212
- :last_name => "Last",
213
- :hire_date => @today,
214
- :description => "description"
208
+ first_name: "First",
209
+ last_name: "Last",
210
+ hire_date: @today,
211
+ description: "description"
215
212
  )
216
213
  empl_id = @employee.id
217
214
  @employee.reload
@@ -226,9 +223,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
226
223
  it "should not update record if nothing is changed and partial writes are enabled" do
227
224
  TestEmployee.partial_writes = true
228
225
  @employee = TestEmployee.create(
229
- :first_name => "First",
230
- :last_name => "Last",
231
- :hire_date => @today
226
+ first_name: "First",
227
+ last_name: "Last",
228
+ hire_date: @today
232
229
  )
233
230
  @employee.reload
234
231
  @employee.save!
@@ -239,9 +236,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
239
236
  it "should update record if nothing is changed and partial writes are disabled" do
240
237
  TestEmployee.partial_writes = false
241
238
  @employee = TestEmployee.create(
242
- :first_name => "First",
243
- :last_name => "Last",
244
- :hire_date => @today
239
+ first_name: "First",
240
+ last_name: "Last",
241
+ hire_date: @today
245
242
  )
246
243
  @employee.reload
247
244
  @employee.save!
@@ -251,9 +248,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
251
248
 
252
249
  it "should delete record" do
253
250
  @employee = TestEmployee.create(
254
- :first_name => "First",
255
- :last_name => "Last",
256
- :hire_date => @today
251
+ first_name: "First",
252
+ last_name: "Last",
253
+ hire_date: @today
257
254
  )
258
255
  @employee.reload
259
256
  empl_id = @employee.id
@@ -264,9 +261,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
264
261
 
265
262
  it "should delete record and set destroyed flag" do
266
263
  @employee = TestEmployee.create(
267
- :first_name => "First",
268
- :last_name => "Last",
269
- :hire_date => @today
264
+ first_name: "First",
265
+ last_name: "Last",
266
+ hire_date: @today
270
267
  )
271
268
  @employee.reload
272
269
  @employee.destroy
@@ -278,9 +275,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
278
275
  TestEmployee.after_destroy :raise_make_transaction_rollback
279
276
 
280
277
  @employee = TestEmployee.create(
281
- :first_name => "First",
282
- :last_name => "Last",
283
- :hire_date => @today
278
+ first_name: "First",
279
+ last_name: "Last",
280
+ hire_date: @today
284
281
  )
285
282
  @employee.reload
286
283
  empl_id = @employee.id
@@ -294,9 +291,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
294
291
 
295
292
  it "should set timestamps when creating record" do
296
293
  @employee = TestEmployee.create(
297
- :first_name => "First",
298
- :last_name => "Last",
299
- :hire_date => @today
294
+ first_name: "First",
295
+ last_name: "Last",
296
+ hire_date: @today
300
297
  )
301
298
  expect(@employee.created_at).not_to be_nil
302
299
  expect(@employee.updated_at).not_to be_nil
@@ -304,9 +301,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
304
301
 
305
302
  it "should set timestamps when updating record" do
306
303
  @employee = TestEmployee.create(
307
- :first_name => "First",
308
- :last_name => "Last",
309
- :hire_date => @today
304
+ first_name: "First",
305
+ last_name: "Last",
306
+ hire_date: @today
310
307
  )
311
308
  @employee.reload
312
309
  expect(@employee.created_at).to be_nil
@@ -320,9 +317,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
320
317
  it "should log create record" do
321
318
  set_logger
322
319
  @employee = TestEmployee.create(
323
- :first_name => "First",
324
- :last_name => "Last",
325
- :hire_date => @today
320
+ first_name: "First",
321
+ last_name: "Last",
322
+ hire_date: @today
326
323
  )
327
324
  expect(@logger.logged(:debug).last).to match(/^TestEmployee Create \(\d+\.\d+(ms)?\) custom create method$/)
328
325
  clear_logger
@@ -331,9 +328,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
331
328
  it "should log update record" do
332
329
  (TestEmployee.partial_writes = false) rescue nil
333
330
  @employee = TestEmployee.create(
334
- :first_name => "First",
335
- :last_name => "Last",
336
- :hire_date => @today
331
+ first_name: "First",
332
+ last_name: "Last",
333
+ hire_date: @today
337
334
  )
338
335
  set_logger
339
336
  @employee.save!
@@ -343,9 +340,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
343
340
 
344
341
  it "should log delete record" do
345
342
  @employee = TestEmployee.create(
346
- :first_name => "First",
347
- :last_name => "Last",
348
- :hire_date => @today
343
+ first_name: "First",
344
+ last_name: "Last",
345
+ hire_date: @today
349
346
  )
350
347
  set_logger
351
348
  @employee.destroy
@@ -355,8 +352,8 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
355
352
 
356
353
  it "should validate new record before creation" do
357
354
  @employee = TestEmployee.new(
358
- :last_name => "Last",
359
- :hire_date => @today
355
+ last_name: "Last",
356
+ hire_date: @today
360
357
  )
361
358
  expect(@employee.save).to be_falsey
362
359
  expect(@employee.errors[:first_name]).not_to be_blank
@@ -364,9 +361,9 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
364
361
 
365
362
  it "should validate existing record before update" do
366
363
  @employee = TestEmployee.create(
367
- :first_name => "First",
368
- :last_name => "Last",
369
- :hire_date => @today
364
+ first_name: "First",
365
+ last_name: "Last",
366
+ hire_date: @today
370
367
  )
371
368
  @employee.first_name = nil
372
369
  expect(@employee.save).to be_falsey