Sha256: 0418bd35302aded211e4769bba7aca233457f8c0998c5c80105bdbc6db6e0fa4
Contents?: true
Size: 648 Bytes
Versions: 6
Compression:
Stored size: 648 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
6 entries across 6 versions & 1 rubygems