pmacs-activerecord-oracle_enhanced-adapter 1.4.2.rc1 → 1.5.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +11 -40
  3. data/History.md +170 -0
  4. data/README.md +61 -5
  5. data/Rakefile +1 -0
  6. data/VERSION +1 -1
  7. data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +330 -161
  8. data/lib/active_record/connection_adapters/oracle_enhanced_column.rb +48 -8
  9. data/lib/active_record/connection_adapters/oracle_enhanced_column_dumper.rb +77 -0
  10. data/lib/active_record/connection_adapters/oracle_enhanced_connection.rb +8 -24
  11. data/lib/active_record/connection_adapters/oracle_enhanced_context_index.rb +4 -13
  12. data/lib/active_record/connection_adapters/oracle_enhanced_database_tasks.rb +61 -0
  13. data/lib/active_record/connection_adapters/oracle_enhanced_dirty.rb +13 -12
  14. data/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb +42 -19
  15. data/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb +28 -74
  16. data/lib/active_record/connection_adapters/oracle_enhanced_procedures.rb +165 -231
  17. data/lib/active_record/connection_adapters/oracle_enhanced_schema_creation.rb +89 -0
  18. data/lib/active_record/connection_adapters/oracle_enhanced_schema_definitions.rb +16 -24
  19. data/lib/active_record/connection_adapters/oracle_enhanced_schema_dumper.rb +29 -38
  20. data/lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb +93 -42
  21. data/lib/active_record/connection_adapters/oracle_enhanced_schema_statements_ext.rb +5 -3
  22. data/lib/active_record/connection_adapters/oracle_enhanced_structure_dump.rb +7 -7
  23. data/lib/active_record/connection_adapters/oracle_enhanced_version.rb +1 -1
  24. data/lib/pmacs-activerecord-oracle_enhanced-adapter.rb +2 -2
  25. data/pmacs-activerecord-oracle_enhanced-adapter.gemspec +19 -17
  26. data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +35 -99
  27. data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +17 -3
  28. data/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +105 -98
  29. data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +74 -44
  30. data/spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb +89 -0
  31. data/spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb +3 -3
  32. data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +13 -2
  33. data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +11 -12
  34. data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +252 -60
  35. data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +170 -40
  36. data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +14 -8
  37. data/spec/spec_helper.rb +25 -54
  38. metadata +41 -72
  39. data/lib/active_record/connection_adapters/oracle_enhanced.rake +0 -105
  40. data/lib/active_record/connection_adapters/oracle_enhanced_activerecord_patches.rb +0 -41
  41. data/lib/active_record/connection_adapters/oracle_enhanced_base_ext.rb +0 -118
  42. data/lib/active_record/connection_adapters/oracle_enhanced_core_ext.rb +0 -25
  43. data/lib/active_record/connection_adapters/oracle_enhanced_tasks.rb +0 -17
  44. data/spec/active_record/connection_adapters/oracle_enhanced_core_ext_spec.rb +0 -19
@@ -89,11 +89,7 @@ describe "OracleEnhancedAdapter date type detection based on column names" do
89
89
  ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = false
90
90
  ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates = false
91
91
  class ::TestEmployee < ActiveRecord::Base
92
- if self.respond_to?(:primary_key=)
93
- self.primary_key = "employee_id"
94
- else
95
- set_primary_key "employee_id"
96
- end
92
+ self.primary_key = "employee_id"
97
93
  end
98
94
  end
99
95
 
@@ -210,6 +206,7 @@ describe "OracleEnhancedAdapter integer type detection based on column names" do
210
206
  job_id NUMBER,
211
207
  salary NUMBER,
212
208
  commission_pct NUMBER(2,2),
209
+ unwise_name_id NUMBER(2,2),
213
210
  manager_id NUMBER(6),
214
211
  is_manager NUMBER(1),
215
212
  department_id NUMBER(4,0),
@@ -222,17 +219,46 @@ describe "OracleEnhancedAdapter integer type detection based on column names" do
222
219
  INCREMENT BY 1 START WITH 10040 CACHE 20 NOORDER NOCYCLE
223
220
  SQL
224
221
  end
225
-
222
+
226
223
  after(:all) do
227
224
  @conn.execute "DROP TABLE test2_employees"
228
225
  @conn.execute "DROP SEQUENCE test2_employees_seq"
229
226
  end
230
227
 
231
- it "should set NUMBER column type as decimal if emulate_integers_by_column_name is false" do
232
- ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_integers_by_column_name = false
233
- columns = @conn.columns('test2_employees')
234
- column = columns.detect{|c| c.name == "job_id"}
235
- column.type.should == :decimal
228
+ context "when number_datatype_coercion is :decimal" do
229
+ before { ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.stub(:number_datatype_coercion).and_return(:decimal) }
230
+
231
+ it "should set NUMBER column type as decimal if emulate_integers_by_column_name is false" do
232
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_integers_by_column_name = false
233
+ columns = @conn.columns('test2_employees')
234
+ column = columns.detect{|c| c.name == "job_id"}
235
+ column.type.should == :decimal
236
+ end
237
+
238
+ it "should set NUMBER column type as decimal if column name is not 'id' and does not ends with '_id' and emulate_integers_by_column_name is true" do
239
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_integers_by_column_name = true
240
+ columns = @conn.columns('test2_employees')
241
+ column = columns.detect{|c| c.name == "salary"}
242
+ column.type.should == :decimal
243
+ end
244
+ end
245
+
246
+ context "when number_datatype_coercion is :float" do
247
+ before { ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.stub(:number_datatype_coercion).and_return(:float) }
248
+
249
+ it "should set NUMBER column type as float if emulate_integers_by_column_name is false" do
250
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_integers_by_column_name = false
251
+ columns = @conn.columns('test2_employees')
252
+ column = columns.detect{|c| c.name == "job_id"}
253
+ column.type.should == :float
254
+ end
255
+
256
+ it "should set NUMBER column type as float if column name is not 'id' and does not ends with '_id' and emulate_integers_by_column_name is true" do
257
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_integers_by_column_name = true
258
+ columns = @conn.columns('test2_employees')
259
+ column = columns.detect{|c| c.name == "salary"}
260
+ column.type.should == :float
261
+ end
236
262
  end
237
263
 
238
264
  it "should set NUMBER column type as integer if emulate_integers_by_column_name is true" do
@@ -244,10 +270,24 @@ describe "OracleEnhancedAdapter integer type detection based on column names" do
244
270
  column.type.should == :integer
245
271
  end
246
272
 
247
- it "should set NUMBER column type as decimal if column name does not contain 'id' and emulate_integers_by_column_name is true" do
273
+ it "should set NUMBER(p,0) column type as integer" do
248
274
  ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_integers_by_column_name = true
249
275
  columns = @conn.columns('test2_employees')
250
- column = columns.detect{|c| c.name == "salary"}
276
+ column = columns.detect{|c| c.name == "department_id"}
277
+ column.type.should == :integer
278
+ end
279
+
280
+ it "should set NUMBER(p,s) column type as integer if column name ends with '_id' and emulate_integers_by_column_name is true" do
281
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_integers_by_column_name = true
282
+ columns = @conn.columns('test2_employees')
283
+ column = columns.detect{|c| c.name == "unwise_name_id"}
284
+ column.type.should == :integer
285
+ end
286
+
287
+ it "should set NUMBER(p,s) column type as decimal if column name ends with '_id' and emulate_integers_by_column_name is false" do
288
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_integers_by_column_name = false
289
+ columns = @conn.columns('test2_employees')
290
+ column = columns.detect{|c| c.name == "unwise_name_id"}
251
291
  column.type.should == :decimal
252
292
  end
253
293
 
@@ -258,7 +298,7 @@ describe "OracleEnhancedAdapter integer type detection based on column names" do
258
298
  column.type_cast(1.0).class.should == BigDecimal
259
299
  end
260
300
 
261
- it "should return Fixnum value from NUMBER column if column name contains 'id' and emulate_integers_by_column_name is true" do
301
+ it "should return Fixnum value from NUMBER column if column name ends with '_id' and emulate_integers_by_column_name is true" do
262
302
  ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_integers_by_column_name = true
263
303
  columns = @conn.columns('test2_employees')
264
304
  column = columns.detect{|c| c.name == "job_id"}
@@ -270,7 +310,7 @@ describe "OracleEnhancedAdapter integer type detection based on column names" do
270
310
  class ::Test2Employee < ActiveRecord::Base
271
311
  end
272
312
  end
273
-
313
+
274
314
  after(:each) do
275
315
  Object.send(:remove_const, "Test2Employee")
276
316
  @conn.clear_types_for_columns
@@ -569,11 +609,7 @@ describe "OracleEnhancedAdapter timestamp with timezone support" do
569
609
  describe "/ TIMESTAMP WITH TIME ZONE values from ActiveRecord model" do
570
610
  before(:all) do
571
611
  class ::TestEmployee < ActiveRecord::Base
572
- if self.respond_to?(:primary_key=)
573
- self.primary_key = "employee_id"
574
- else
575
- set_primary_key "employee_id"
576
- end
612
+ self.primary_key = "employee_id"
577
613
  end
578
614
  end
579
615
 
@@ -614,7 +650,6 @@ describe "OracleEnhancedAdapter timestamp with timezone support" do
614
650
 
615
651
  end
616
652
 
617
-
618
653
  describe "OracleEnhancedAdapter date and timestamp with different NLS date formats" do
619
654
  before(:all) do
620
655
  ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
@@ -655,11 +690,7 @@ describe "OracleEnhancedAdapter date and timestamp with different NLS date forma
655
690
  ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates = false
656
691
  ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = false
657
692
  class ::TestEmployee < ActiveRecord::Base
658
- if self.respond_to?(:primary_key=)
659
- self.primary_key = "employee_id"
660
- else
661
- set_primary_key "employee_id"
662
- end
693
+ self.primary_key = "employee_id"
663
694
  end
664
695
  @today = Date.new(2008,6,28)
665
696
  @now = Time.local(2008,6,28,13,34,33)
@@ -744,11 +775,7 @@ describe "OracleEnhancedAdapter assign string to :date and :datetime columns" do
744
775
  INCREMENT BY 1 CACHE 20 NOORDER NOCYCLE
745
776
  SQL
746
777
  class ::TestEmployee < ActiveRecord::Base
747
- if self.respond_to?(:primary_key=)
748
- self.primary_key = "employee_id"
749
- else
750
- set_primary_key "employee_id"
751
- end
778
+ self.primary_key = "employee_id"
752
779
  end
753
780
  @today = Date.new(2008,6,28)
754
781
  @today_iso = "2008-06-28"
@@ -879,7 +906,7 @@ describe "OracleEnhancedAdapter assign string to :date and :datetime columns" do
879
906
  @employee.reload
880
907
  @employee.last_login_at.should == @today.to_time
881
908
  end
882
-
909
+
883
910
  end
884
911
 
885
912
  describe "OracleEnhancedAdapter handling of CLOB columns" do
@@ -918,7 +945,7 @@ describe "OracleEnhancedAdapter handling of CLOB columns" do
918
945
  serialize :comments
919
946
  end
920
947
  class ::TestEmployeeReadOnlyClob < ActiveRecord::Base
921
- set_table_name :test_employees
948
+ self.table_name = "test_employees"
922
949
  attr_readonly :comments
923
950
  end
924
951
  end
@@ -1052,6 +1079,18 @@ describe "OracleEnhancedAdapter handling of CLOB columns" do
1052
1079
  @employee.reload
1053
1080
  @employee.comments.should == @char_data
1054
1081
  end
1082
+
1083
+ it "should keep unchanged serialized data when other columns changed" do
1084
+ @employee = Test2Employee.create!(
1085
+ :first_name => "First",
1086
+ :last_name => "Last",
1087
+ :comments => "initial serialized data"
1088
+ )
1089
+ @employee.first_name = "Steve"
1090
+ @employee.save
1091
+ @employee.reload
1092
+ @employee.comments.should == "initial serialized data"
1093
+ end
1055
1094
  end
1056
1095
 
1057
1096
  describe "OracleEnhancedAdapter handling of BLOB columns" do
@@ -1081,11 +1120,7 @@ describe "OracleEnhancedAdapter handling of BLOB columns" do
1081
1120
 
1082
1121
  before(:each) do
1083
1122
  class ::TestEmployee < ActiveRecord::Base
1084
- if self.respond_to?(:primary_key=)
1085
- self.primary_key = "employee_id"
1086
- else
1087
- set_primary_key "employee_id"
1088
- end
1123
+ self.primary_key = "employee_id"
1089
1124
  end
1090
1125
  end
1091
1126
 
@@ -1211,11 +1246,7 @@ describe "OracleEnhancedAdapter handling of RAW columns" do
1211
1246
 
1212
1247
  before(:each) do
1213
1248
  class ::TestEmployee < ActiveRecord::Base
1214
- if self.respond_to?(:primary_key=)
1215
- self.primary_key = "employee_id"
1216
- else
1217
- set_primary_key "employee_id"
1218
- end
1249
+ self.primary_key = "employee_id"
1219
1250
  end
1220
1251
  end
1221
1252
 
@@ -1313,7 +1344,6 @@ describe "OracleEnhancedAdapter handling of RAW columns" do
1313
1344
  end
1314
1345
  end
1315
1346
 
1316
-
1317
1347
  describe "OracleEnhancedAdapter quoting of NCHAR and NVARCHAR2 columns" do
1318
1348
  before(:all) do
1319
1349
  ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
@@ -0,0 +1,89 @@
1
+ require 'spec_helper'
2
+ require 'active_record/connection_adapters/oracle_enhanced_database_tasks'
3
+ require 'stringio'
4
+ require 'tempfile'
5
+
6
+ describe "Oracle Enhanced adapter database tasks" do
7
+ let(:config) { CONNECTION_PARAMS.with_indifferent_access }
8
+
9
+ describe "create" do
10
+ let(:new_user_config) { config.merge({username: "oracle_enhanced_test_user"}) }
11
+ before do
12
+ fake_terminal(SYSTEM_CONNECTION_PARAMS[:password]) do
13
+ ActiveRecord::Tasks::DatabaseTasks.create(new_user_config)
14
+ end
15
+ end
16
+ it "creates user" do
17
+ query = "SELECT COUNT(*) FROM dba_users WHERE UPPER(username) = '#{new_user_config[:username].upcase}'"
18
+ ActiveRecord::Base.connection.select_value(query).should == 1
19
+ end
20
+ after do
21
+ ActiveRecord::Base.connection.execute("DROP USER #{new_user_config[:username]}");
22
+ end
23
+
24
+ def fake_terminal(input)
25
+ $stdin = StringIO.new
26
+ $stdout = StringIO.new
27
+ $stdin.puts(input)
28
+ $stdin.rewind
29
+ yield
30
+ ensure
31
+ $stdin = STDIN
32
+ $stdout = STDOUT
33
+ end
34
+ end
35
+
36
+ context "with test table" do
37
+ before do
38
+ ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
39
+ ActiveRecord::Base.connection.execute "CREATE TABLE test_posts (name VARCHAR2(20))"
40
+ end
41
+
42
+ describe "drop" do
43
+ before { ActiveRecord::Tasks::DatabaseTasks.drop(config) }
44
+ it "drops all tables" do
45
+ ActiveRecord::Base.connection.table_exists?(:test_posts).should be_false
46
+ end
47
+ end
48
+
49
+ describe "purge" do
50
+ before { ActiveRecord::Tasks::DatabaseTasks.purge(config) }
51
+ it "drops all tables" do
52
+ ActiveRecord::Base.connection.table_exists?(:test_posts).should be_false
53
+ ActiveRecord::Base.connection.select_value("SELECT COUNT(*) FROM RECYCLEBIN").should == 0
54
+ end
55
+ end
56
+
57
+ describe "structure" do
58
+ let(:temp_file) { Tempfile.new(["oracle_enhanced", ".sql"]).path }
59
+ before { ActiveRecord::SchemaMigration.create_table }
60
+
61
+ describe "structure_dump" do
62
+ before { ActiveRecord::Tasks::DatabaseTasks.structure_dump(config, temp_file) }
63
+ it "dumps the database structure to a file" do
64
+ contents = File.read(temp_file)
65
+ contents.should include('CREATE TABLE "TEST_POSTS"')
66
+ end
67
+ end
68
+
69
+ describe "structure_load" do
70
+ before do
71
+ ActiveRecord::Tasks::DatabaseTasks.structure_dump(config, temp_file)
72
+ ActiveRecord::Tasks::DatabaseTasks.drop(config)
73
+ ActiveRecord::Tasks::DatabaseTasks.structure_load(config, temp_file)
74
+ end
75
+ it "loads the database structure from a file" do
76
+ ActiveRecord::Base.connection.table_exists?(:test_posts).should be_true
77
+ end
78
+ end
79
+
80
+ after do
81
+ File.delete(temp_file)
82
+ ActiveRecord::SchemaMigration.drop_table
83
+ end
84
+ end
85
+
86
+ after { ActiveRecord::Base.connection.execute "DROP TABLE test_posts" rescue nil }
87
+ end
88
+ end
89
+
@@ -42,7 +42,7 @@ describe "OracleEnhancedAdapter logging dbms_output from plsql" do
42
42
  it "should NOT log dbms output when dbms output is disabled" do
43
43
  @conn.disable_dbms_output
44
44
 
45
- @conn.select_all("select more_than_five_characters_long('hi there') is_it_long from dual").should == [{'is_it_long'=>1}]
45
+ @conn.select_all("select more_than_five_characters_long('hi there') is_it_long from dual").to_a.should == [{'is_it_long'=>1}]
46
46
 
47
47
  @logger.output(:debug).should_not match(/^DBMS_OUTPUT/)
48
48
  end
@@ -50,7 +50,7 @@ describe "OracleEnhancedAdapter logging dbms_output from plsql" do
50
50
  it "should log dbms output lines to the rails log" do
51
51
  @conn.enable_dbms_output
52
52
 
53
- @conn.select_all("select more_than_five_characters_long('hi there') is_it_long from dual").should == [{'is_it_long'=>1}]
53
+ @conn.select_all("select more_than_five_characters_long('hi there') is_it_long from dual").to_a.should == [{'is_it_long'=>1}]
54
54
 
55
55
  @logger.output(:debug).should match(/^DBMS_OUTPUT: before the if -hi there-$/)
56
56
  @logger.output(:debug).should match(/^DBMS_OUTPUT: it is longer than 5$/)
@@ -60,7 +60,7 @@ describe "OracleEnhancedAdapter logging dbms_output from plsql" do
60
60
  it "should log dbms output lines to the rails log" do
61
61
  @conn.enable_dbms_output
62
62
 
63
- @conn.select_all("select more_than_five_characters_long('short') is_it_long from dual").should == [{'is_it_long'=>0}]
63
+ @conn.select_all("select more_than_five_characters_long('short') is_it_long from dual").to_a.should == [{'is_it_long'=>0}]
64
64
 
65
65
  @logger.output(:debug).should match(/^DBMS_OUTPUT: before the if -short-$/)
66
66
  @logger.output(:debug).should match(/^DBMS_OUTPUT: it is 5 or shorter$/)
@@ -16,6 +16,7 @@ if ActiveRecord::Base.method_defined?(:changed?)
16
16
  last_name VARCHAR2(25),
17
17
  job_id NUMBER(6,0) NULL,
18
18
  salary NUMBER(8,2),
19
+ pto_per_hour NUMBER,
19
20
  comments CLOB,
20
21
  hire_date DATE
21
22
  )
@@ -27,7 +28,7 @@ if ActiveRecord::Base.method_defined?(:changed?)
27
28
  class TestEmployee < ActiveRecord::Base
28
29
  end
29
30
  end
30
-
31
+
31
32
  after(:all) do
32
33
  Object.send(:remove_const, "TestEmployee")
33
34
  @conn.execute "DROP TABLE test_employees"
@@ -62,6 +63,16 @@ if ActiveRecord::Base.method_defined?(:changed?)
62
63
  @employee.should_not be_changed
63
64
  end
64
65
 
66
+ it "should not mark empty float (stored as NULL) as changed when reassigning it" do
67
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.stub(:number_datatype_coercion) { :float }
68
+ @employee = TestEmployee.create!(:pto_per_hour => '')
69
+ @employee.pto_per_hour = ''
70
+ @employee.should_not be_changed
71
+ @employee.reload
72
+ @employee.pto_per_hour = ''
73
+ @employee.should_not be_changed
74
+ end
75
+
65
76
  it "should not mark empty text (stored as NULL) as changed when reassigning it" do
66
77
  @employee = TestEmployee.create!(:comments => nil)
67
78
  @employee.comments = nil
@@ -111,7 +122,7 @@ if ActiveRecord::Base.method_defined?(:changed?)
111
122
  @employee = TestEmployee.new
112
123
  @employee.job_id = 0
113
124
  @employee.save!.should be_true
114
-
125
+
115
126
  @employee.should_not be_changed
116
127
 
117
128
  @employee.job_id = '0'
@@ -107,11 +107,8 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
107
107
 
108
108
  before(:each) do
109
109
  class ::TestEmployee < ActiveRecord::Base
110
- if self.respond_to?(:primary_key=)
111
- self.primary_key = :employee_id
112
- else
113
- set_primary_key :employee_id
114
- end
110
+ include ActiveRecord::OracleEnhancedProcedures
111
+ self.primary_key = :employee_id
115
112
 
116
113
  validates_presence_of :first_name, :last_name, :hire_date
117
114
 
@@ -226,9 +223,8 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
226
223
  @employee.first_name.should == "First"
227
224
  end
228
225
 
229
- it "should not update record if nothing is changed and partial updates are enabled" do
230
- return pending("Not in this ActiveRecord version") unless TestEmployee.respond_to?(:partial_updates=)
231
- TestEmployee.partial_updates = true
226
+ it "should not update record if nothing is changed and partial writes are enabled" do
227
+ TestEmployee.partial_writes = true
232
228
  @employee = TestEmployee.create(
233
229
  :first_name => "First",
234
230
  :last_name => "Last",
@@ -240,9 +236,8 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
240
236
  @employee.version.should == 1
241
237
  end
242
238
 
243
- it "should update record if nothing is changed and partial updates are disabled" do
244
- return pending("Not in this ActiveRecord version") unless TestEmployee.respond_to?(:partial_updates=)
245
- TestEmployee.partial_updates = false
239
+ it "should update record if nothing is changed and partial writes are disabled" do
240
+ TestEmployee.partial_writes = false
246
241
  @employee = TestEmployee.create(
247
242
  :first_name => "First",
248
243
  :last_name => "Last",
@@ -295,6 +290,7 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
295
290
  }.should raise_error("Make the transaction rollback")
296
291
  @employee.id.should == empl_id
297
292
  TestEmployee.find_by_employee_id(empl_id).should_not be_nil
293
+ clear_logger
298
294
  end
299
295
 
300
296
  it "should set timestamps when creating record" do
@@ -330,10 +326,11 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
330
326
  :hire_date => @today
331
327
  )
332
328
  @logger.logged(:debug).last.should match(/^TestEmployee Create \(\d+\.\d+(ms)?\) custom create method$/)
329
+ clear_logger
333
330
  end
334
331
 
335
332
  it "should log update record" do
336
- (TestEmployee.partial_updates = false) rescue nil
333
+ (TestEmployee.partial_writes = false) rescue nil
337
334
  @employee = TestEmployee.create(
338
335
  :first_name => "First",
339
336
  :last_name => "Last",
@@ -342,6 +339,7 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
342
339
  set_logger
343
340
  @employee.save!
344
341
  @logger.logged(:debug).last.should match(/^TestEmployee Update \(\d+\.\d+(ms)?\) custom update method with employee_id=#{@employee.id}$/)
342
+ clear_logger
345
343
  end
346
344
 
347
345
  it "should log delete record" do
@@ -353,6 +351,7 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
353
351
  set_logger
354
352
  @employee.destroy
355
353
  @logger.logged(:debug).last.should match(/^TestEmployee Destroy \(\d+\.\d+(ms)?\) custom delete method with employee_id=#{@employee.id}$/)
354
+ clear_logger
356
355
  end
357
356
 
358
357
  it "should validate new record before creation" do