Permalink
Browse files

Revert "test pg, we don't care about the internal state of `column#de…

…fault`."

Revert "test pg, remove unused column assignments. Follow up to 254cdf4"

Related to #15492

This reverts commit 254cdf4.
This reverts commit 4bcf902.

There are public methods that assume `Column#default` is type casted.
The return value of `Column#default` is publicly relevant and should not change.

/cc @sgrif
  • Loading branch information...
1 parent 4097ff5 commit 9b09e60fbf5b17b2b6d1f8902f10bf82b5e2aa27 @senny senny committed Jun 3, 2014
@@ -38,6 +38,9 @@ def test_column
def test_default
@connection.add_column 'pg_arrays', 'score', :integer, array: true, default: [4, 4, 2]
PgArray.reset_column_information
+ column = PgArray.columns_hash["score"]
+
+ assert_equal([4, 4, 2], column.default)
assert_equal([4, 4, 2], PgArray.new.score)
ensure
PgArray.reset_column_information
@@ -48,6 +51,7 @@ def test_default_strings
PgArray.reset_column_information
column = PgArray.columns_hash["names"]
+ assert_equal(["foo", "bar"], column.default)
assert_equal(["foo", "bar"], PgArray.new.names)
ensure
PgArray.reset_column_information
@@ -42,7 +42,12 @@ def test_bit_string_varying_column
end
def test_default
+ column = PostgresqlBitString.columns_hash["a_bit"]
+ assert_equal "00000011", column.default
assert_equal "00000011", PostgresqlBitString.new.a_bit
+
+ column = PostgresqlBitString.columns_hash["a_bit_varying"]
+ assert_equal "0011", column.default
assert_equal "0011", PostgresqlBitString.new.a_bit_varying
end
@@ -44,6 +44,7 @@ def test_enum_defaults
PostgresqlEnum.reset_column_information
column = PostgresqlEnum.columns_hash["good_mood"]
+ assert_equal "happy", column.default
assert_equal "happy", PostgresqlEnum.new.good_mood
ensure
PostgresqlEnum.reset_column_information
@@ -35,7 +35,12 @@ def test_column
end
def test_default
+ column = PostgresqlPoint.columns_hash["y"]
+ assert_equal [12.2, 13.3], column.default
assert_equal [12.2, 13.3], PostgresqlPoint.new.y
+
+ column = PostgresqlPoint.columns_hash["z"]
+ assert_equal [14.4, 15.5], column.default
assert_equal [14.4, 15.5], PostgresqlPoint.new.z
end
@@ -64,6 +64,9 @@ def test_column
def test_default
@connection.add_column 'hstores', 'permissions', :hstore, default: '"users"=>"read", "articles"=>"write"'
Hstore.reset_column_information
+ column = Hstore.columns_hash["permissions"]
+
+ assert_equal({"users"=>"read", "articles"=>"write"}, column.default)
assert_equal({"users"=>"read", "articles"=>"write"}, Hstore.new.permissions)
ensure
Hstore.reset_column_information
@@ -43,6 +43,9 @@ def test_column
def test_default
@connection.add_column 'json_data_type', 'permissions', :json, default: '{"users": "read", "posts": ["read", "write"]}'
JsonDataType.reset_column_information
+ column = JsonDataType.columns_hash["permissions"]
+
+ assert_equal({"users"=>"read", "posts"=>["read", "write"]}, column.default)
assert_equal({"users"=>"read", "posts"=>["read", "write"]}, JsonDataType.new.permissions)
ensure
JsonDataType.reset_column_information
@@ -32,6 +32,8 @@ def test_column
end
def test_default
+ column = PostgresqlMoney.columns_hash["depth"]
+ assert_equal BigDecimal.new("150.55"), column.default
assert_equal BigDecimal.new("150.55"), PostgresqlMoney.new.depth
end

0 comments on commit 9b09e60

Please sign in to comment.