Created
February 3, 2014 16:12
-
-
Save senny/8786850 to your computer and use it in GitHub Desktop.
Trying to reproduce https://github.com/rails/rails/pull/12718
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 characters
require 'bundler' | |
Bundler.setup(:default) | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
create_table :posts do |t| | |
t.string :key | |
end | |
end | |
class Post < ActiveRecord::Base | |
end | |
class BugTest < Minitest::Test | |
def test_order_by_key | |
Post.create(key: "b") | |
Post.create(key: "c") | |
Post.create(key: "a") | |
assert_equal ["a", "b", "c"], Post.order(:key).to_a.map(&:key) | |
end | |
end |
Author
senny
commented
Feb 3, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment