Sha256: 54faaa73e6b8bda5fcbe1327911d685ac1db5fbbc8c97c55cd65f713f0f34167
Contents?: true
Size: 1.13 KB
Versions: 6
Compression:
Stored size: 1.13 KB
Contents
require "test_helper" class BagTest < ActiveSupport::TestCase def setup @order = Order.new end test "has a bag" do assert @order.respond_to?(:bag) end test "has setters and getters" do assert @order.respond_to?(:field) assert @order.respond_to?(:flag) assert @order.respond_to?(:at) assert @order.respond_to?(:field=) assert @order.respond_to?(:flag=) assert @order.respond_to?(:flag?) assert @order.respond_to?(:at=) end test "string access to field" do value = "abc" @order.field = value assert_equal value, @order.field assert_not_equal "def", @order.field end test "date access to at" do value = DateTime.now @order.at = value assert_equal value, @order.at assert_not_equal "def", @order.at end test "bag is hidden" do value = "abc" @order.field = value @order.bag = "bad thing" assert_equal value, @order.field end test "merge for :at :date" do model = :order params = {model => {"at(1i)" => "1", "at(2i)" => "2", "at(3i)" => "3"}} res = Order.merge({}, params) assert_equal Date.new(1, 2, 3), res[model][:at] end end
Version data entries
6 entries across 6 versions & 1 rubygems