aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/defaults_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-04 07:41:28 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-04 07:44:06 -0600
commit405fd22e70e4c2d1117ace0a834cbcc438ea8ca9 (patch)
tree96aa53abe36a6064f78b77d1fd38bd9cd6bed9de /activerecord/test/cases/defaults_test.rb
parent0329d59a65a5afbf57de83670e3e05e4a73815e4 (diff)
downloadrails-405fd22e70e4c2d1117ace0a834cbcc438ea8ca9.tar.gz
rails-405fd22e70e4c2d1117ace0a834cbcc438ea8ca9.tar.bz2
rails-405fd22e70e4c2d1117ace0a834cbcc438ea8ca9.zip
Collapse PG default extractoin of most types to single regex
For any type that is represented as a string and then type cast, we do not need separate regular expressions for the various types. No function will match this regex. User defined types *should* match this, so that the type object can decide what to do with the value.
Diffstat (limited to 'activerecord/test/cases/defaults_test.rb')
-rw-r--r--activerecord/test/cases/defaults_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/defaults_test.rb b/activerecord/test/cases/defaults_test.rb
index f885a8cbc0..92144bc802 100644
--- a/activerecord/test/cases/defaults_test.rb
+++ b/activerecord/test/cases/defaults_test.rb
@@ -206,6 +206,11 @@ if current_adapter?(:PostgreSQLAdapter)
assert_equal "some text", Default.new.text_col, "Default of text column was not correctly parse after updating default using '::text' since postgreSQL will add parens to the default in db"
end
+ def test_default_containing_quote_and_colons
+ @connection.execute "ALTER TABLE defaults ALTER COLUMN string_col SET DEFAULT 'foo''::bar'"
+ assert_equal "foo'::bar", Default.new.string_col
+ end
+
teardown do
@connection.schema_search_path = @old_search_path
Default.reset_column_information