Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ Performance/OpenStruct:
Enabled: true

# RuboCop RSpec cops
RSpec/BeEq:
Enabled: true

RSpec/BeNil:
Enabled: true

RSpec/EmptyLineAfterExampleGroup:
Enabled: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
it "should not use JDBC statement caching" do
if ORACLE_ENHANCED_CONNECTION == :jdbc
ActiveRecord::Base.establish_connection(SYSTEM_CONNECTION_PARAMS)
expect(ActiveRecord::Base.connection.raw_connection.getImplicitCachingEnabled).to eq(false)
expect(ActiveRecord::Base.connection.raw_connection.getImplicitCachingEnabled).to be(false)
expect(ActiveRecord::Base.connection.raw_connection.getStatementCacheSize).to eq(-1)
end
end

it "should use JDBC statement caching" do
if ORACLE_ENHANCED_CONNECTION == :jdbc
ActiveRecord::Base.establish_connection(SYSTEM_CONNECTION_PARAMS.merge(jdbc_statement_cache_size: 100))
expect(ActiveRecord::Base.connection.raw_connection.getImplicitCachingEnabled).to eq(true)
expect(ActiveRecord::Base.connection.raw_connection.getImplicitCachingEnabled).to be(true)
expect(ActiveRecord::Base.connection.raw_connection.getStatementCacheSize).to eq(100)
# else: don't raise error if OCI connection has parameter "jdbc_statement_cache_size", still ignore it
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,12 @@ class ::TestFraction < ActiveRecord::Base

it "should include virtual columns and not try to update them" do
tf = TestFraction.columns.detect { |c| c.virtual? }
expect(tf).not_to be nil
expect(tf).not_to be_nil
expect(tf.name).to eq("percent")
expect(tf.virtual?).to be true
expect do
tf = TestFraction.new(numerator: 20, denominator: 100)
expect(tf.percent).to be nil # not whatever is in DATA_DEFAULT column
expect(tf.percent).to be_nil # not whatever is in DATA_DEFAULT column
tf.save!
tf.reload
end.not_to raise_error
Expand All @@ -1014,11 +1014,11 @@ class ::TestFraction < ActiveRecord::Base
end
TestFraction.reset_column_information
tf = TestFraction.columns.detect { |c| c.name == "rem" }
expect(tf).not_to be nil
expect(tf).not_to be_nil
expect(tf.virtual?).to be true
expect do
tf = TestFraction.new(numerator: 7, denominator: 5)
expect(tf.rem).to be nil
expect(tf.rem).to be_nil
tf.save!
tf.reload
end.not_to raise_error
Expand All @@ -1031,13 +1031,13 @@ class ::TestFraction < ActiveRecord::Base
end
TestFraction.reset_column_information
tf = TestFraction.columns.detect { |c| c.name == "expression" }
expect(tf).not_to be nil
expect(tf).not_to be_nil
expect(tf.virtual?).to be true
expect(tf.type).to be :string
expect(tf.limit).to be 100
expect do
tf = TestFraction.new(numerator: 7, denominator: 5)
expect(tf.expression).to be nil
expect(tf.expression).to be_nil
tf.save!
tf.reload
end.not_to raise_error
Expand All @@ -1051,14 +1051,14 @@ class ::TestFraction < ActiveRecord::Base
end
TestFraction.reset_column_information
tf = TestFraction.columns.detect { |c| c.name == "percent" }
expect(tf).not_to be nil
expect(tf).not_to be_nil
expect(tf.virtual?).to be true
expect(tf.type).to be :decimal
expect(tf.precision).to be 15
expect(tf.scale).to be 2
expect do
tf = TestFraction.new(numerator: 11, denominator: 17)
expect(tf.percent).to be nil
expect(tf.percent).to be_nil
tf.save!
tf.reload
end.not_to raise_error
Expand All @@ -1071,14 +1071,14 @@ class ::TestFraction < ActiveRecord::Base
end
TestFraction.reset_column_information
tf = TestFraction.columns.detect { |c| c.name == "percent" }
expect(tf).not_to be nil
expect(tf).not_to be_nil
expect(tf.virtual?).to be true
expect(tf.type).to be :decimal
expect(tf.precision).to be 12
expect(tf.scale).to be 5
expect do
tf = TestFraction.new(numerator: 11, denominator: 17)
expect(tf.percent).to be nil
expect(tf.percent).to be_nil
tf.save!
tf.reload
end.not_to raise_error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,12 @@ class ::TestSerializedColumn < ActiveRecord::Base
serialized_column.serialized << new_value
expect(serialized_column.serialized).to eq([new_value])
serialized_column.save
expect(serialized_column.save!).to eq(true)
expect(serialized_column.save!).to be(true)

serialized_column.reload
expect(serialized_column.serialized).to eq([new_value])
serialized_column.serialized = []
expect(serialized_column.save!).to eq(true)
expect(serialized_column.save!).to be(true)
end
end

Expand Down Expand Up @@ -516,7 +516,7 @@ class ::TestBinaryColumn < ActiveRecord::Base
binary_column_object = TestBinaryColumn.new
binary_column_object.attachment = binary_value

expect(binary_column_object.save!).to eq(true)
expect(binary_column_object.save!).to be(true)
end
end

Expand Down Expand Up @@ -624,8 +624,8 @@ class Group < ActiveRecord::Base
end

it "should test table existence" do
expect(@conn.table_exists?("TEST_POSTS")).to eq true
expect(@conn.table_exists?("NOT_EXISTING")).to eq false
expect(@conn.table_exists?("TEST_POSTS")).to be true
expect(@conn.table_exists?("NOT_EXISTING")).to be false
end

it "should return array from indexes with bind usage" do
Expand Down Expand Up @@ -656,7 +656,7 @@ class Group < ActiveRecord::Base
end

it "should return false from temporary_table? with bind usage" do
expect(@conn.temporary_table?("TEST_POSTS")).to eq false
expect(@conn.temporary_table?("TEST_POSTS")).to be false
expect(@logger.logged(:debug).last).to match(/:table_name/)
expect(@logger.logged(:debug).last).to match(/\["table_name", "TEST_POSTS"\]/)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/active_record/oracle_enhanced/type/boolean_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ class ::Test3Employee < ActiveRecord::Base
expect(@employee3.test_boolean_before_type_cast).to eq("N")
create_employee3(test_boolean: nil)
expect(@employee3.test_boolean.class).to eq(NilClass)
expect(@employee3.test_boolean_before_type_cast).to eq(nil)
expect(@employee3.test_boolean_before_type_cast).to be_nil
create_employee3(test_boolean: "")
expect(@employee3.test_boolean.class).to eq(NilClass)
expect(@employee3.test_boolean_before_type_cast).to eq(nil)
expect(@employee3.test_boolean_before_type_cast).to be_nil
end

it "should return string value from VARCHAR2 column with boolean column name but attribute is set to :string" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ::TestSerializeEmployee < ActiveRecord::Base
@employee.reload
expect(@employee.comments).to eq(@nclob_data)
@employee.comments = @nclob_data2
expect(@employee.save).to eq(true)
expect(@employee.save).to be(true)
@employee.reload
expect(@employee.comments).to eq(@nclob_data)
end
Expand All @@ -90,12 +90,12 @@ class ::TestSerializeEmployee < ActiveRecord::Base
comments: nil
)
expect(@employee.comments).to be_nil
expect(@employee.save).to eq(true)
expect(@employee.save).to be(true)
expect(@employee).to be_valid
@employee.reload
expect(@employee.comments).to be_nil
@employee.comments = {}
expect(@employee.save).to eq(true)
expect(@employee.save).to be(true)
@employee.reload
# should not set readonly
expect(@employee.comments).to be_nil
Expand Down
6 changes: 3 additions & 3 deletions spec/active_record/oracle_enhanced/type/text_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ::TestSerializeEmployee < ActiveRecord::Base
@employee.reload
expect(@employee.comments).to eq("initial")
@employee.comments = "changed"
expect(@employee.save).to eq(true)
expect(@employee.save).to be(true)
@employee.reload
expect(@employee.comments).to eq("initial")
end
Expand All @@ -89,12 +89,12 @@ class ::TestSerializeEmployee < ActiveRecord::Base
comments: nil
)
expect(@employee.comments).to be_nil
expect(@employee.save).to eq(true)
expect(@employee.save).to be(true)
expect(@employee).to be_valid
@employee.reload
expect(@employee.comments).to be_nil
@employee.comments = {}
expect(@employee.save).to eq(true)
expect(@employee.save).to be(true)
@employee.reload
# should not set readonly
expect(@employee.comments).to be_nil
Expand Down