Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User defined types should not raise an error
Fixes #15697 on 4-1-stable.
- Loading branch information
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
activerecord/test/cases/adapters/postgresql/custom_domain_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'cases/helper' | ||
|
||
class PostgreSQLCustomDomainTest < ActiveRecord::TestCase | ||
class CustomDomain < ActiveRecord::Base | ||
end | ||
|
||
setup do | ||
@connection = ActiveRecord::Base.connection | ||
@connection.execute "CREATE DOMAIN password AS TEXT" | ||
@connection.create_table :custom_domains do |t| | ||
t.column :passwd, 'password' | ||
end | ||
end | ||
|
||
teardown do | ||
if @connection | ||
@connection.execute 'DROP TABLE IF EXISTS custom_domains' | ||
@connection.execute 'DROP DOMAIN IF EXISTS password' | ||
end | ||
end | ||
|
||
test "custom domain types do not create errors" do | ||
silence_warnings do | ||
record = CustomDomain.create!(passwd: 'password') | ||
assert_equal record.id, CustomDomain.where(passwd: 'password').last.id | ||
end | ||
end | ||
end |