aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migration/column_attributes_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/migration/column_attributes_test.rb')
-rw-r--r--activerecord/test/cases/migration/column_attributes_test.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/activerecord/test/cases/migration/column_attributes_test.rb b/activerecord/test/cases/migration/column_attributes_test.rb
index 847000fa0e..ab8229dbae 100644
--- a/activerecord/test/cases/migration/column_attributes_test.rb
+++ b/activerecord/test/cases/migration/column_attributes_test.rb
@@ -9,7 +9,7 @@ module ActiveRecord
def test_add_column_newline_default
string = "foo\nbar"
- add_column "test_models", "command", :string, :default => string
+ add_column "test_models", "command", :string, default: string
TestModel.reset_column_information
assert_equal string, TestModel.new.command
@@ -58,7 +58,7 @@ module ActiveRecord
def test_native_decimal_insert_manual_vs_automatic
correct_value = "0012345678901234567890.0123456789".to_d
- connection.add_column "test_models", "wealth", :decimal, :precision => "30", :scale => "10"
+ connection.add_column "test_models", "wealth", :decimal, precision: "30", scale: "10"
# Do a manual insertion
if current_adapter?(:OracleAdapter)
@@ -82,7 +82,7 @@ module ActiveRecord
TestModel.delete_all
# Now use the Rails insertion
- TestModel.create :wealth => BigDecimal.new("12345678901234567890.0123456789")
+ TestModel.create wealth: BigDecimal.new("12345678901234567890.0123456789")
# SELECT
row = TestModel.first
@@ -94,7 +94,7 @@ module ActiveRecord
end
def test_add_column_with_precision_and_scale
- connection.add_column "test_models", "wealth", :decimal, :precision => 9, :scale => 7
+ connection.add_column "test_models", "wealth", :decimal, precision: 9, scale: 7
wealth_column = TestModel.columns_hash["wealth"]
assert_equal 9, wealth_column.precision
@@ -104,13 +104,13 @@ module ActiveRecord
if current_adapter?(:SQLite3Adapter)
def test_change_column_preserve_other_column_precision_and_scale
connection.add_column "test_models", "last_name", :string
- connection.add_column "test_models", "wealth", :decimal, :precision => 9, :scale => 7
+ connection.add_column "test_models", "wealth", :decimal, precision: 9, scale: 7
wealth_column = TestModel.columns_hash["wealth"]
assert_equal 9, wealth_column.precision
assert_equal 7, wealth_column.scale
- connection.change_column "test_models", "last_name", :string, :null => false
+ connection.change_column "test_models", "last_name", :string, null: false
TestModel.reset_column_information
wealth_column = TestModel.columns_hash["wealth"]
@@ -126,17 +126,17 @@ module ActiveRecord
add_column "test_models", "bio", :text
add_column "test_models", "age", :integer
add_column "test_models", "height", :float
- add_column "test_models", "wealth", :decimal, :precision => "30", :scale => "10"
+ add_column "test_models", "wealth", :decimal, precision: "30", scale: "10"
add_column "test_models", "birthday", :datetime
add_column "test_models", "favorite_day", :date
add_column "test_models", "moment_of_truth", :datetime
add_column "test_models", "male", :boolean
- TestModel.create :first_name => "bob", :last_name => "bobsen",
- :bio => "I was born ....", :age => 18, :height => 1.78,
- :wealth => BigDecimal.new("12345678901234567890.0123456789"),
- :birthday => 18.years.ago, :favorite_day => 10.days.ago,
- :moment_of_truth => "1782-10-10 21:40:18", :male => true
+ TestModel.create first_name: "bob", last_name: "bobsen",
+ bio: "I was born ....", age: 18, height: 1.78,
+ wealth: BigDecimal.new("12345678901234567890.0123456789"),
+ birthday: 18.years.ago, favorite_day: 10.days.ago,
+ moment_of_truth: "1782-10-10 21:40:18", male: true
bob = TestModel.first
assert_equal "bob", bob.first_name
@@ -164,10 +164,10 @@ module ActiveRecord
if current_adapter?(:Mysql2Adapter, :PostgreSQLAdapter)
def test_out_of_range_limit_should_raise
- assert_raise(ActiveRecordError) { add_column :test_models, :integer_too_big, :integer, :limit => 10 }
+ assert_raise(ActiveRecordError) { add_column :test_models, :integer_too_big, :integer, limit: 10 }
unless current_adapter?(:PostgreSQLAdapter)
- assert_raise(ActiveRecordError) { add_column :test_models, :text_too_big, :integer, :limit => 0xfffffffff }
+ assert_raise(ActiveRecordError) { add_column :test_models, :text_too_big, :integer, limit: 0xfffffffff }
end
end
end