Created
December 22, 2016 19:48
-
-
Save claudiob/5724f2c0aeaf59b356e3955359eee921 to your computer and use it in GitHub Desktop.
Revisions
-
claudiob created this gist
Dec 22, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ begin require "bundler/inline" rescue LoadError => e $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" raise e end gemfile(true) do source "https://rubygems.org" # If you change the version to "5.0.0.1", the test will pass. # `git bisect` says that 9c28c54879 is the first bad commit. gem "activerecord", "5.0.1" gem "pg" end require "active_record" require "minitest/autorun" require "logger" # This connection will do for database-independent bug reports. ActiveRecord::Base.establish_connection adapter: "postgresql" ActiveRecord::Base.connection.drop_database "test_group_enum" ActiveRecord::Base.connection.create_database "test_group_enum" ActiveRecord::Base.establish_connection adapter: "postgresql", database: "test_group_enum" ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Schema.define do create_table :posts, force: true do |t| t.integer :category end end class Post < ActiveRecord::Base enum category: %i(sport entertainment) end class BugTest < Minitest::Test def test_association_stuff Post.create! category: 'sport' Post.create! category: 'entertainment' # Up to Rails 5.0.0.1, this was the result: assert_equal Post.group(:category).count, {1=>1, 0=>1} # Since Rails 5.0.1 this is the result instead: # assert_equal Post.group(:category).count, {"sport"=>1, "entertainment"=>1} # `git bisect` says that 9c28c54879 is the first bad commit. end end