Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@ffortin 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
You can’t perform that action at this time.