Skip to content

Instantly share code, notes, and snippets.

@UncleGene
Created September 15, 2013 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UncleGene/6572152 to your computer and use it in GitHub Desktop.
Save UncleGene/6572152 to your computer and use it in GitHub Desktop.
Bug in rails 3 that is declared to be a feature!
gem 'activerecord', '~> 3.0'
require 'active_record'
require 'minitest/autorun'
require 'logger'
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'activerecord_unittest')
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
drop_table :records if table_exists? :records
create_table :records do |t|
t.timestamps
end
end
class Record < ActiveRecord::Base
end
class CuriousFirstTest < MiniTest::Unit::TestCase
def test_first_last
r = Record.create
Record.create
r.touch
assert_equal 2, Record.count
assert Record.first != Record.last, 'First of 2 records is also last!'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment