activerecord-oracle_enhanced-adapter 1.6.5 → 1.6.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60a3ec980dcf98f634383b6ae254f5de37b549f7
4
- data.tar.gz: d217ce9bc4b2ee4352746ca29eae5c639496b92f
3
+ metadata.gz: d4eeebb449df33ca90a32d115eb7560f63620e7f
4
+ data.tar.gz: b44d067ce520271d27dff3e695cc0e2a8a0304f1
5
5
  SHA512:
6
- metadata.gz: 091010e46da037032c6714d2522c9097dbb3acd156a9ebecd240fc9154c73163f4e84e0e996ddbe27ae0ca64e2f13261370d61825aca3ab20fd997602362e3fc
7
- data.tar.gz: 81622c33e2565fbe6292aa70214f865db3dd9d3cb623aac56ae65ebf7669e911e09a6c6251503654e5ce893c34b56e140d105def665be8fa6dc58e68e5fa215a
6
+ metadata.gz: b17c6f686b146973b005f5818c7325aed083703c459dcc78e28249a8fae881251ab426c3bf145d2f82f8f6050d8abba935f9fb589b00ad714d68cd33840a3cad
7
+ data.tar.gz: 292f74cb32c919c502953774f36e934e4b24ff51c26beecf4585cb571412bf58893947d2e7d7edc42ec9fac17885768d011c1d7294c1d4185a6ec64a2eacee6c
data/History.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.6.6 / 2016-01-21
2
+
3
+ * Changes and bug fixes since 1.6.5
4
+ * Address ORA-00904 when CONTAINS has `table_name.column_name` [#758, #664, #463]
5
+ * Only convert N to false when emulating booleans [#751]
6
+ * Clean up specs and test documentation [#756]
7
+ * Add JDBC Drivers to gitignore [#745]
8
+
1
9
  ## 1.6.5 / 2015-12-01
2
10
 
3
11
  * Enhancement
data/RUNNING_TESTS.md CHANGED
@@ -16,7 +16,9 @@ to increase process limit and then restart the database (this will be necessary
16
16
  Ruby versions
17
17
  -------------
18
18
 
19
- It is recommended to use [RVM](http://rvm.beginrescueend.com) to run tests with different Ruby implementations. oracle_enhanced is mainly tested with MRI 1.8.7 (all Rails versions) and 1.9.2 (Rails 3) and JRuby 1.6.
19
+ oracle_enhanced is tested with MRI 2.1.x and 2.2.x, and JRuby 1.7.x and 9.0.x.x.
20
+
21
+ It is recommended to use [RVM](http://rvm.beginrescueend.com) to run tests with different Ruby implementations.
20
22
 
21
23
  Running tests
22
24
  -------------
@@ -29,19 +31,19 @@ Running tests
29
31
  SQL> CREATE USER oracle_enhanced_schema IDENTIFIED BY oracle_enhanced_schema;
30
32
  SQL> GRANT unlimited tablespace, create session, create table, create sequence, create procedure, create trigger, create view, create materialized view, create database link, create synonym, create type, ctxapp TO oracle_enhanced_schema;
31
33
 
32
- * If you use RVM then switch to corresponding Ruby (1.8.7, 1.9.2 or JRuby) and it is recommended to create isolated gemset for test purposes (e.g. rvm create gemset oracle_enhanced)
34
+ * If you use RVM then switch to corresponding Ruby. It is recommended to create isolated gemsets for test purposes (e.g. rvm create gemset oracle_enhanced)
33
35
 
34
36
  * Install bundler with
35
37
 
36
38
  gem install bundler
37
39
 
38
- * Set RAILS_GEM_VERSION to Rails version that you would like to use in oracle_enhanced tests, e.g.
39
-
40
- export RAILS_GEM_VERSION=3.0.3
41
-
42
40
  * Install necessary gems with
43
41
 
44
42
  bundle install
43
+
44
+ * Configure database credentials in one of two ways:
45
+ * copy spec/spec_config.yaml.template to spec/config.yaml and modify as needed
46
+ * set required environment variables (see DATABASE_NAME in spec_helper.rb)
45
47
 
46
48
  * Run tests with
47
49
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.5
1
+ 1.6.6
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{activerecord-oracle_enhanced-adapter}
8
- s.version = "1.6.5"
8
+ s.version = "1.6.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.license = 'MIT'
12
12
  s.authors = [%q{Raimonds Simanovskis}]
13
- s.date = %q{2015-12-01}
13
+ s.date = %q{2015-01-21}
14
14
  s.description = %q{Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
15
15
  This adapter is superset of original ActiveRecord Oracle adapter.
16
16
  }
@@ -332,7 +332,7 @@ module ActiveRecord
332
332
  # Add context index condition.
333
333
  def contains(column, query, options ={})
334
334
  score_label = options[:label].to_i || 1
335
- where("CONTAINS(#{connection.quote_column_name(column)}, ?, #{score_label}) > 0", query).
335
+ where("CONTAINS(#{connection.quote_table_name(column)}, ?, #{score_label}) > 0", query).
336
336
  order("SCORE(#{score_label}) DESC")
337
337
  end
338
338
  end
@@ -1075,7 +1075,7 @@ module ActiveRecord
1075
1075
  row['data_default'].sub!(/^'(.*)'$/m, '\1')
1076
1076
  row['data_default'] = nil if row['data_default'] =~ /^(null|empty_[bc]lob\(\))$/i
1077
1077
  # TODO: Needs better fix to fallback "N" to false
1078
- row['data_default'] = false if row['data_default'] == "N"
1078
+ row['data_default'] = false if (row['data_default'] == "N" && OracleEnhancedAdapter.emulate_booleans_from_strings)
1079
1079
  end
1080
1080
 
1081
1081
  # TODO: Consider to extract another method such as `get_cast_type`
@@ -171,7 +171,7 @@ describe "OracleEnhancedAdapter" do
171
171
  end
172
172
 
173
173
  it 'should identify virtual columns as such' do
174
- pending "Not supported in this database version" unless @oracle11g_or_higher
174
+ skip "Not supported in this database version" unless @oracle11g_or_higher
175
175
  te = TestEmployee.connection.columns('test_employees').detect(&:virtual?)
176
176
  te.name.should == 'full_name'
177
177
  end
@@ -274,7 +274,7 @@ describe "OracleEnhancedAdapter" do
274
274
  end
275
275
 
276
276
  it "should tell ActiveRecord that count distinct is supported" do
277
- ActiveRecord::Base.connection.supports_count_distinct?.should be_true
277
+ ActiveRecord::Base.connection.supports_count_distinct?.should be true
278
278
  end
279
279
 
280
280
  it "should execute correct SQL COUNT DISTINCT statement" do
@@ -345,56 +345,56 @@ describe "OracleEnhancedAdapter" do
345
345
  end
346
346
 
347
347
  it "should be valid with letters and digits" do
348
- @adapter.valid_table_name?("abc_123").should be_true
348
+ @adapter.valid_table_name?("abc_123").should be true
349
349
  end
350
350
 
351
351
  it "should be valid with schema name" do
352
- @adapter.valid_table_name?("abc_123.def_456").should be_true
352
+ @adapter.valid_table_name?("abc_123.def_456").should be true
353
353
  end
354
354
 
355
355
  it "should be valid with $ in name" do
356
- @adapter.valid_table_name?("sys.v$session").should be_true
356
+ @adapter.valid_table_name?("sys.v$session").should be true
357
357
  end
358
358
 
359
359
  it "should be valid with upcase schema name" do
360
- @adapter.valid_table_name?("ABC_123.DEF_456").should be_true
360
+ @adapter.valid_table_name?("ABC_123.DEF_456").should be true
361
361
  end
362
362
 
363
363
  it "should be valid with irregular schema name and database links" do
364
- @adapter.valid_table_name?('abc$#_123.abc$#_123@abc$#@._123').should be_true
364
+ @adapter.valid_table_name?('abc$#_123.abc$#_123@abc$#@._123').should be true
365
365
  end
366
366
 
367
367
  it "should not be valid with two dots in name" do
368
- @adapter.valid_table_name?("abc_123.def_456.ghi_789").should be_false
368
+ @adapter.valid_table_name?("abc_123.def_456.ghi_789").should be false
369
369
  end
370
370
 
371
371
  it "should not be valid with invalid characters" do
372
- @adapter.valid_table_name?("warehouse-things").should be_false
372
+ @adapter.valid_table_name?("warehouse-things").should be false
373
373
  end
374
374
 
375
375
  it "should not be valid with for camel-case" do
376
- @adapter.valid_table_name?("Abc").should be_false
377
- @adapter.valid_table_name?("aBc").should be_false
378
- @adapter.valid_table_name?("abC").should be_false
376
+ @adapter.valid_table_name?("Abc").should be false
377
+ @adapter.valid_table_name?("aBc").should be false
378
+ @adapter.valid_table_name?("abC").should be false
379
379
  end
380
380
 
381
381
  it "should not be valid for names > 30 characters" do
382
- @adapter.valid_table_name?("a" * 31).should be_false
382
+ @adapter.valid_table_name?("a" * 31).should be false
383
383
  end
384
384
 
385
385
  it "should not be valid for schema names > 30 characters" do
386
- @adapter.valid_table_name?(("a" * 31) + ".validname").should be_false
386
+ @adapter.valid_table_name?(("a" * 31) + ".validname").should be false
387
387
  end
388
388
 
389
389
  it "should not be valid for database links > 128 characters" do
390
- @adapter.valid_table_name?("name@" + "a" * 129).should be_false
390
+ @adapter.valid_table_name?("name@" + "a" * 129).should be false
391
391
  end
392
392
 
393
393
  it "should not be valid for names that do not begin with alphabetic characters" do
394
- @adapter.valid_table_name?("1abc").should be_false
395
- @adapter.valid_table_name?("_abc").should be_false
396
- @adapter.valid_table_name?("abc.1xyz").should be_false
397
- @adapter.valid_table_name?("abc._xyz").should be_false
394
+ @adapter.valid_table_name?("1abc").should be false
395
+ @adapter.valid_table_name?("_abc").should be false
396
+ @adapter.valid_table_name?("abc.1xyz").should be false
397
+ @adapter.valid_table_name?("abc._xyz").should be false
398
398
  end
399
399
  end
400
400
 
@@ -554,7 +554,7 @@ describe "OracleEnhancedAdapter" do
554
554
  @conn.create_table :foos, :temporary => true, :id => false do |t|
555
555
  t.integer :id
556
556
  end
557
- @conn.temporary_table?("foos").should be_true
557
+ @conn.temporary_table?("foos").should be true
558
558
  end
559
559
  end
560
560
 
@@ -600,7 +600,7 @@ describe "OracleEnhancedAdapter" do
600
600
  posts.size.should == @ids.size
601
601
  end
602
602
 
603
- end if ENV['RAILS_GEM_VERSION'] >= '3.1'
603
+ end
604
604
 
605
605
  describe "with statement pool" do
606
606
  before(:all) do
@@ -654,7 +654,7 @@ describe "OracleEnhancedAdapter" do
654
654
  @conn.exec_update("UPDATE test_posts SET id = 1", "SQL", binds)
655
655
  }.should_not change(@statements, :length)
656
656
  end
657
- end if ENV['RAILS_GEM_VERSION'] >= '3.1'
657
+ end
658
658
 
659
659
  describe "explain" do
660
660
  before(:all) do
@@ -688,7 +688,7 @@ describe "OracleEnhancedAdapter" do
688
688
  explain.should include("Cost")
689
689
  explain.should include("INDEX UNIQUE SCAN")
690
690
  end
691
- end if ENV['RAILS_GEM_VERSION'] >= '3.2'
691
+ end
692
692
 
693
693
  describe "using offset and limit" do
694
694
  before(:all) do
@@ -16,7 +16,7 @@ describe "OracleEnhancedConnection" do
16
16
  end
17
17
 
18
18
  it "should ping active connection" do
19
- @conn.ping.should be_true
19
+ @conn.ping.should be true
20
20
  end
21
21
 
22
22
  it "should not ping inactive connection" do
@@ -149,7 +149,7 @@ describe "OracleEnhancedConnection" do
149
149
  import 'org.apache.commons.dbcp.PoolableConnectionFactory'
150
150
  import 'org.apache.commons.dbcp.DriverManagerConnectionFactory'
151
151
  rescue NameError => e
152
- return pending e.message
152
+ return skip e.message
153
153
  end
154
154
 
155
155
  class InitialContextMock
@@ -170,7 +170,7 @@ describe "OracleEnhancedConnection" do
170
170
  end
171
171
  end
172
172
 
173
- javax.naming.InitialContext.stub!(:new).and_return(InitialContextMock.new)
173
+ javax.naming.InitialContext.stub(:new).and_return(InitialContextMock.new)
174
174
 
175
175
  params = {}
176
176
  params[:jndi] = 'java:comp/env/jdbc/test'
@@ -185,7 +185,7 @@ describe "OracleEnhancedConnection" do
185
185
  params[:url] = "jdbc:oracle:thin:@#{DATABASE_HOST && "//#{DATABASE_HOST}#{DATABASE_PORT && ":#{DATABASE_PORT}"}/"}#{DATABASE_NAME}"
186
186
  params[:host] = nil
187
187
  params[:database] = nil
188
- java.sql.DriverManager.stub!(:getConnection).and_raise('no suitable driver found')
188
+ java.sql.DriverManager.stub(:getConnection).and_raise('no suitable driver found')
189
189
  @conn = ActiveRecord::ConnectionAdapters::OracleEnhancedConnection.create(params)
190
190
  @conn.should be_active
191
191
  end
@@ -103,7 +103,7 @@ describe "OracleEnhancedAdapter context index" do
103
103
 
104
104
  it "should not include text index secondary tables in user tables list" do
105
105
  @conn.add_context_index :posts, :title
106
- @conn.tables.any?{|t| t =~ /^dr\$/i}.should be_false
106
+ @conn.tables.any?{|t| t =~ /^dr\$/i}.should be false
107
107
  @conn.remove_context_index :posts, :title
108
108
  end
109
109
 
@@ -169,6 +169,14 @@ describe "OracleEnhancedAdapter context index" do
169
169
  end
170
170
  @conn.remove_context_index :posts, :title
171
171
  end
172
+
173
+ it "should use index when contains has schema_name.table_name syntax" do
174
+ @conn.add_context_index :posts, :title
175
+ @title_words.each do |word|
176
+ Post.contains('posts.title', word).to_a.should == [@post2, @post1]
177
+ end
178
+ @conn.remove_context_index :posts, :title
179
+ end
172
180
  end
173
181
 
174
182
  describe "on multiple tables" do
@@ -52,7 +52,7 @@ describe "OracleEnhancedAdapter composite_primary_keys support" do
52
52
  end
53
53
 
54
54
  it "should tell ActiveRecord that count distinct is not supported" do
55
- ActiveRecord::Base.connection.supports_count_distinct?.should be_false
55
+ ActiveRecord::Base.connection.supports_count_distinct?.should be false
56
56
  end
57
57
 
58
58
  it "should execute correct SQL COUNT DISTINCT statement on table with composite primary keys" do
@@ -376,6 +376,43 @@ describe "OracleEnhancedAdapter boolean type detection based on string column ty
376
376
  ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_booleans_from_strings = false
377
377
  end
378
378
 
379
+ before(:each) do
380
+ class ::Test3Employee < ActiveRecord::Base
381
+ end
382
+ end
383
+
384
+ after(:each) do
385
+ Object.send(:remove_const, "Test3Employee")
386
+ @conn.clear_types_for_columns
387
+ ActiveRecord::Base.clear_cache! if ActiveRecord::Base.respond_to?(:"clear_cache!")
388
+ end
389
+
390
+ describe "default values in new records" do
391
+ context "when emulate_booleans_from_strings is false" do
392
+ before do
393
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_booleans_from_strings = false
394
+ end
395
+
396
+ it "are Y or N" do
397
+ subject = Test3Employee.new
398
+ expect(subject.has_phone).to eq('Y')
399
+ expect(subject.manager_yn).to eq('N')
400
+ end
401
+ end
402
+
403
+ context "when emulate_booleans_from_strings is true" do
404
+ before do
405
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_booleans_from_strings = true
406
+ end
407
+
408
+ it "are True or False" do
409
+ subject = Test3Employee.new
410
+ expect(subject.has_phone).to be_a(TrueClass)
411
+ expect(subject.manager_yn).to be_a(FalseClass)
412
+ end
413
+ end
414
+ end
415
+
379
416
  it "should set CHAR/VARCHAR2 column type as string if emulate_booleans_from_strings is false" do
380
417
  ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_booleans_from_strings = false
381
418
  columns = @conn.columns('test3_employees')
@@ -437,19 +474,16 @@ describe "OracleEnhancedAdapter boolean type detection based on string column ty
437
474
  it "should get default value from VARCHAR2 boolean column if emulate_booleans_from_strings is true" do
438
475
  ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_booleans_from_strings = true
439
476
  columns = @conn.columns('test3_employees')
440
- columns.detect{|c| c.name == 'has_phone'}.default.should be_true
441
- columns.detect{|c| c.name == 'manager_yn'}.default.should be_false
477
+ columns.detect{|c| c.name == 'has_phone'}.default.should eq 'Y'
478
+ columns.detect{|c| c.name == 'manager_yn'}.default.should be false
442
479
  end
443
480
 
444
481
  describe "/ VARCHAR2 boolean values from ActiveRecord model" do
445
482
  before(:each) do
446
483
  ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_booleans_from_strings = false
447
- class ::Test3Employee < ActiveRecord::Base
448
- end
449
484
  end
450
485
 
451
486
  after(:each) do
452
- Object.send(:remove_const, "Test3Employee")
453
487
  @conn.clear_types_for_columns
454
488
  ActiveRecord::Base.clear_cache! if ActiveRecord::Base.respond_to?(:"clear_cache!")
455
489
  end
@@ -42,14 +42,14 @@ describe "Oracle Enhanced adapter database tasks" do
42
42
  describe "drop" do
43
43
  before { ActiveRecord::Tasks::DatabaseTasks.drop(config) }
44
44
  it "drops all tables" do
45
- ActiveRecord::Base.connection.table_exists?(:test_posts).should be_false
45
+ ActiveRecord::Base.connection.table_exists?(:test_posts).should be false
46
46
  end
47
47
  end
48
48
 
49
49
  describe "purge" do
50
50
  before { ActiveRecord::Tasks::DatabaseTasks.purge(config) }
51
51
  it "drops all tables" do
52
- ActiveRecord::Base.connection.table_exists?(:test_posts).should be_false
52
+ ActiveRecord::Base.connection.table_exists?(:test_posts).should be false
53
53
  ActiveRecord::Base.connection.select_value("SELECT COUNT(*) FROM RECYCLEBIN").should == 0
54
54
  end
55
55
  end
@@ -77,7 +77,7 @@ describe "Oracle Enhanced adapter database tasks" do
77
77
  ActiveRecord::Tasks::DatabaseTasks.structure_load(config, temp_file)
78
78
  end
79
79
  it "loads the database structure from a file" do
80
- ActiveRecord::Base.connection.table_exists?(:test_posts).should be_true
80
+ ActiveRecord::Base.connection.table_exists?(:test_posts).should be true
81
81
  end
82
82
  end
83
83
 
@@ -110,7 +110,7 @@ if ActiveRecord::Base.method_defined?(:changed?)
110
110
  it "should not mark integer as changed when reassigning it" do
111
111
  @employee = TestEmployee.new
112
112
  @employee.job_id = 0
113
- @employee.save!.should be_true
113
+ @employee.save.should be true
114
114
 
115
115
  @employee.should_not be_changed
116
116
 
@@ -122,7 +122,7 @@ if ActiveRecord::Base.method_defined?(:changed?)
122
122
  @employee = TestEmployee.create!(
123
123
  :comments => "initial"
124
124
  )
125
- @employee.save!.should be_true
125
+ @employee.save.should be true
126
126
  @employee.reload
127
127
  @employee.comments.should == 'initial'
128
128
 
@@ -130,7 +130,7 @@ if ActiveRecord::Base.method_defined?(:changed?)
130
130
  class << oci_conn
131
131
  def write_lob(lob, value, is_binary = false); raise "don't do this'"; end
132
132
  end
133
- @employee.save!.should_not raise_exception(RuntimeError, "don't do this'")
133
+ expect { @employee.save! }.to_not raise_error
134
134
  class << oci_conn
135
135
  remove_method :write_lob
136
136
  end
@@ -12,7 +12,7 @@ describe "OracleEnhancedAdapter emulate OracleAdapter" do
12
12
  it "should be an OracleAdapter" do
13
13
  @conn = ActiveRecord::Base.establish_connection(CONNECTION_PARAMS.merge(:emulate_oracle_adapter => true))
14
14
  ActiveRecord::Base.connection.should_not be_nil
15
- ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::OracleAdapter).should be_true
15
+ ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::OracleAdapter).should be true
16
16
  end
17
17
 
18
18
  after(:all) do
@@ -186,7 +186,7 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
186
186
  lambda {
187
187
  @employee.save
188
188
  }.should raise_error("Make the transaction rollback")
189
- @employee.id.should == nil
189
+ @employee.new_record?.should be true
190
190
  TestEmployee.count.should == employees_count
191
191
  end
192
192
 
@@ -263,7 +263,6 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
263
263
  end
264
264
 
265
265
  it "should delete record and set destroyed flag" do
266
- return pending("Not in this ActiveRecord version (requires >= 2.3.5)") unless TestEmployee.method_defined?(:destroyed?)
267
266
  @employee = TestEmployee.create(
268
267
  :first_name => "First",
269
268
  :last_name => "Last",
@@ -360,7 +359,7 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
360
359
  :last_name => "Last",
361
360
  :hire_date => @today
362
361
  )
363
- @employee.save.should be_false
362
+ @employee.save.should be false
364
363
  @employee.errors[:first_name].should_not be_blank
365
364
  end
366
365
 
@@ -371,7 +370,7 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
371
370
  :hire_date => @today
372
371
  )
373
372
  @employee.first_name = nil
374
- @employee.save.should be_false
373
+ @employee.save.should be false
375
374
  @employee.errors[:first_name].should_not be_blank
376
375
  end
377
376
 
@@ -226,7 +226,7 @@ describe "OracleEnhancedAdapter schema dump" do
226
226
  end
227
227
 
228
228
  it "should include composite foreign keys" do
229
- pending "Composite foreign keys are not supported in this version"
229
+ skip "Composite foreign keys are not supported in this version"
230
230
  schema_define do
231
231
  add_column :test_posts, :baz_id, :integer
232
232
  add_column :test_posts, :fooz_id, :integer
@@ -341,7 +341,7 @@ describe "OracleEnhancedAdapter schema dump" do
341
341
 
342
342
  it "should specify non-default tablespace in add index" do
343
343
  tablespace_name = @conn.default_tablespace
344
- @conn.stub!(:default_tablespace).and_return('dummy')
344
+ @conn.stub(:default_tablespace).and_return('dummy')
345
345
  create_test_posts_table
346
346
  standard_dump.should =~ /add_index "test_posts", \["title"\], name: "index_test_posts_on_title", tablespace: "#{tablespace_name}"$/
347
347
  end
@@ -369,21 +369,18 @@ describe "OracleEnhancedAdapter schema dump" do
369
369
 
370
370
  describe 'virtual columns' do
371
371
  before(:all) do
372
- if @oracle11g_or_higher
373
- schema_define do
374
- create_table :test_names, :force => true do |t|
375
- t.string :first_name
376
- t.string :last_name
377
- t.virtual :full_name, :as => "first_name || ', ' || last_name"
378
- t.virtual :short_name, :as => "COALESCE(first_name, last_name)", :type => :string, :limit => 300
379
- t.virtual :abbrev_name, :as => "SUBSTR(first_name,1,50) || ' ' || SUBSTR(last_name,1,1) || '.'", :type => "VARCHAR(100)"
380
- t.virtual :name_ratio, :as=>'(LENGTH(first_name)*10/LENGTH(last_name)*10)'
381
- t.column :full_name_length, :virtual, :as => "length(first_name || ', ' || last_name)", :type => :integer
382
- t.virtual :field_with_leading_space, :as => "' ' || first_name || ' '", :limit => 300, :type => :string
383
- end
372
+ skip "Not supported in this database version" unless @oracle11g_or_higher
373
+ schema_define do
374
+ create_table :test_names, :force => true do |t|
375
+ t.string :first_name
376
+ t.string :last_name
377
+ t.virtual :full_name, :as => "first_name || ', ' || last_name"
378
+ t.virtual :short_name, :as => "COALESCE(first_name, last_name)", :type => :string, :limit => 300
379
+ t.virtual :abbrev_name, :as => "SUBSTR(first_name,1,50) || ' ' || SUBSTR(last_name,1,1) || '.'", :type => "VARCHAR(100)"
380
+ t.virtual :name_ratio, :as => '(LENGTH(first_name)*10/LENGTH(last_name)*10)'
381
+ t.column :full_name_length, :virtual, :as => "length(first_name || ', ' || last_name)", :type => :integer
382
+ t.virtual :field_with_leading_space, :as => "' ' || first_name || ' '", :limit => 300, :type => :string
384
383
  end
385
- else
386
- pending "Not supported in this database version"
387
384
  end
388
385
  end
389
386
 
@@ -729,7 +729,7 @@ end
729
729
  end
730
730
 
731
731
  it "should add a composite foreign key" do
732
- pending "Composite foreign keys are not supported in this version"
732
+ skip "Composite foreign keys are not supported in this version"
733
733
  schema_define do
734
734
  add_column :test_posts, :baz_id, :integer
735
735
  add_column :test_posts, :fooz_id, :integer
@@ -752,7 +752,7 @@ end
752
752
  end
753
753
 
754
754
  it "should add a composite foreign key with name" do
755
- pending "Composite foreign keys are not supported in this version"
755
+ skip "Composite foreign keys are not supported in this version"
756
756
  schema_define do
757
757
  add_column :test_posts, :baz_id, :integer
758
758
  add_column :test_posts, :fooz_id, :integer
@@ -1069,7 +1069,7 @@ end
1069
1069
  end
1070
1070
  end
1071
1071
  class ::TestPost < ActiveRecord::Base; end
1072
- TestPost.columns_hash['title'].null.should be_false
1072
+ TestPost.columns_hash['title'].null.should be false
1073
1073
  end
1074
1074
 
1075
1075
  after(:each) do
@@ -1083,7 +1083,7 @@ end
1083
1083
  change_column :test_posts, :title, :string, :null => true
1084
1084
  end
1085
1085
  TestPost.reset_column_information
1086
- TestPost.columns_hash['title'].null.should be_true
1086
+ TestPost.columns_hash['title'].null.should be true
1087
1087
  end
1088
1088
 
1089
1089
  it "should add column" do
@@ -1159,7 +1159,7 @@ end
1159
1159
 
1160
1160
  describe 'virtual columns in create_table' do
1161
1161
  before(:each) do
1162
- pending "Not supported in this database version" unless @oracle11g_or_higher
1162
+ skip "Not supported in this database version" unless @oracle11g_or_higher
1163
1163
  end
1164
1164
 
1165
1165
  it 'should create virtual column with old syntax' do
@@ -1205,7 +1205,7 @@ end
1205
1205
 
1206
1206
  describe 'virtual columns' do
1207
1207
  before(:each) do
1208
- pending "Not supported in this database version" unless @oracle11g_or_higher
1208
+ skip "Not supported in this database version" unless @oracle11g_or_higher
1209
1209
  expr = "( numerator/NULLIF(denominator,0) )*100"
1210
1210
  schema_define do
1211
1211
  create_table :test_fractions, :force => true do |t|
@@ -92,7 +92,7 @@ describe "OracleEnhancedAdapter structure dump" do
92
92
  end
93
93
 
94
94
  it "should dump composite foreign keys" do
95
- pending "Composite foreign keys are not supported in this version"
95
+ skip "Composite foreign keys are not supported in this version"
96
96
  @conn.add_column :foos, :fooz_id, :integer
97
97
  @conn.add_column :foos, :baz_id, :integer
98
98
 
@@ -150,7 +150,7 @@ describe "OracleEnhancedAdapter structure dump" do
150
150
  end
151
151
 
152
152
  it "should dump virtual columns" do
153
- pending "Not supported in this database version" unless @oracle11g_or_higher
153
+ skip "Not supported in this database version" unless @oracle11g_or_higher
154
154
  @conn.execute <<-SQL
155
155
  CREATE TABLE bars (
156
156
  id NUMBER(38,0) NOT NULL,
@@ -163,7 +163,7 @@ describe "OracleEnhancedAdapter structure dump" do
163
163
  end
164
164
 
165
165
  it "should dump RAW virtual columns" do
166
- pending "Not supported in this database version" unless @oracle11g_or_higher
166
+ skip "Not supported in this database version" unless @oracle11g_or_higher
167
167
  @conn.execute <<-SQL
168
168
  CREATE TABLE bars (
169
169
  id NUMBER(38,0) NOT NULL,
@@ -1,5 +1,5 @@
1
- rails:
2
- gem_version: '4.0-master'
1
+ # copy this file to spec/config.yaml and set appropriate values
2
+ # you can also use environment variables, see spec_helper.rb
3
3
  database:
4
4
  name: 'orcl'
5
5
  host: '127.0.0.1'
@@ -7,4 +7,5 @@ database:
7
7
  user: 'oracle_enhanced'
8
8
  password: 'oracle_enhanced'
9
9
  sys_password: 'admin'
10
+ non_default_tablespace: 'SYSTEM'
10
11
  timezone: 'Europe/Riga'
data/spec/spec_helper.rb CHANGED
@@ -22,11 +22,8 @@ elsif RUBY_ENGINE == 'jruby'
22
22
  puts "==> Running specs with JRuby version #{JRUBY_VERSION}"
23
23
  end
24
24
 
25
- ENV['RAILS_GEM_VERSION'] ||= config["rails"]["gem_version"] || '4.0-master'
26
25
  NO_COMPOSITE_PRIMARY_KEYS = true
27
26
 
28
- puts "==> Selected Rails version #{ENV['RAILS_GEM_VERSION']}"
29
-
30
27
  require 'active_record'
31
28
 
32
29
  require 'action_dispatch'
@@ -166,7 +163,7 @@ SYSTEM_CONNECTION_PARAMS = {
166
163
  :password => DATABASE_SYS_PASSWORD
167
164
  }
168
165
 
169
- DATABASE_NON_DEFAULT_TABLESPACE = ENV['DATABASE_NON_DEFAULT_TABLESPACE'] || "SYSTEM"
166
+ DATABASE_NON_DEFAULT_TABLESPACE = config["database"]["non_default_tablespace"] || ENV['DATABASE_NON_DEFAULT_TABLESPACE'] || "SYSTEM"
170
167
 
171
168
  # set default time zone in TZ environment variable
172
169
  # which will be used to set session time zone
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-oracle_enhanced-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.5
4
+ version: 1.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raimonds Simanovskis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2016-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jeweler
@@ -269,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  version: '0'
270
270
  requirements: []
271
271
  rubyforge_project:
272
- rubygems_version: 2.4.8
272
+ rubygems_version: 2.4.5.1
273
273
  signing_key:
274
274
  specification_version: 4
275
275
  summary: Oracle enhanced adapter for ActiveRecord