Skip to content

Instantly share code, notes, and snippets.

@batter
Created October 14, 2013 19:35
Show Gist options
  • Save batter/6980875 to your computer and use it in GitHub Desktop.
Save batter/6980875 to your computer and use it in GitHub Desktop.
Bug report test created from the ActiveRecord template for gems for rails/rails#12505.
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.0.0'
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 :users do |t|
t.string :name
end
end
class User < ActiveRecord::Base
serialize :name
end
class BugTest < MiniTest::Unit::TestCase
def test_changed_attributes_of_serialized_attribute
user = User.new
assert !user.name_changed?
assert_equal Hash.new, user.changed_attributes
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment