Last active
August 29, 2015 14:15
-
-
Save palkan/70b3cc8f1456c858824f to your computer and use it in GitHub Desktop.
Rails issue #18695
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
# Activate the gem you are reporting the issue against. | |
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'activerecord', '4.2.0' | |
gem 'pg', '0.18' | |
gem 'pry-byebug' | |
GEMFILE | |
system 'bundle' | |
end | |
require 'bundler' | |
Bundler.setup(:default) | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
require 'pry-byebug' | |
ISSUE = 18695 | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'activerecord_unittest') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
enable_extension "uuid-ossp" | |
create_table "#{ISSUE}_settings", id: false do |t| | |
t.uuid :user_id | |
end | |
execute "ALTER TABLE \"#{ISSUE}_settings\" ADD PRIMARY KEY (user_id);" | |
end | |
class BugTest < Minitest::Test | |
def teardown | |
ActiveRecord::Base.connection.execute("drop table \"#{ISSUE}_settings\"") | |
end | |
def test_schema_dumper | |
dumper = ActiveRecord::SchemaDumper.send(:new, ActiveRecord::Base.connection) | |
strio = StringIO.new | |
dumper.send(:table, "#{ISSUE}_settings", strio) | |
assert_match /\bid:\s*:uuid\b/, strio.string | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment