Skip to content

Instantly share code, notes, and snippets.

@ffortin
Created September 24, 2014 15:16
Show Gist options
  • Save ffortin/04469945cc2e47a0c56c to your computer and use it in GitHub Desktop.
Save ffortin/04469945cc2e47a0c56c to your computer and use it in GitHub Desktop.
Test fails on store_accessor dup
require 'bundler'
Bundler.setup(:default)
require 'active_record'
require 'minitest/autorun'
require 'logger'
ActiveRecord::Base.logger = Logger.new(STDOUT)
class Contact < ActiveRecord::Base
store_accessor :properties, :name, :phone
end
class BugTest < Minitest::Unit::TestCase
def test_hstore_accessor
p = Contact.new(name: 'Bob', phone: '123')
p2 = p.dup
assert_equal("Bob", p.name) #PASS
assert_equal("123", p.phone) #PASS
assert_equal("Bob", p2.name) #FAIL
assert_equal("123", p2.phone) #FAIL
end
end
@ffortin
Copy link
Author

ffortin commented Sep 24, 2014

p2.name, p2.phone => nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment