Sha256: 4ab323a4744d367cb01d23bf79a5f8f80f4b9e75e6f4dc49de93efb8b0ed74eb
Contents?: true
Size: 652 Bytes
Versions: 16
Compression:
Stored size: 652 Bytes
Contents
require 'test_helper' class Order < ActiveRecord::Base add_to_bag :name add_to_bag :name2 end class CleanTest < ActiveSupport::TestCase def setup @order = Order.new end test "assigning nil removes field from bag" do value = 'abc' assert_equal false, @order.bag.has_key?(:name) @order.name = value assert_equal true, @order.bag.has_key?(:name) @order.name = nil assert_equal false, @order.bag.has_key?(:name) end test "assigning nil to not yet initialized field" do assert_equal false, @order.bag.has_key?(:name2) @order.name2 = nil assert_equal false, @order.bag.has_key?(:name2) end end
Version data entries
16 entries across 16 versions & 1 rubygems