Sha256: 4c7f5707034e2ed22c20108a62326e12267eed4d5062ff6b79348694ee304593
Contents?: true
Size: 640 Bytes
Versions: 19
Compression:
Stored size: 640 Bytes
Contents
require 'test_helper' class WriteableTest < MiniTest::Spec Location = Struct.new(:country) class LocationForm < Reform::Form property :country, writeable: false end let (:loc) { Location.new("Australia") } let (:form) { LocationForm.new(loc) } it do form.country.must_equal "Australia" form.validate("country" => "Germany") # this usually won't change when submitting. form.country.must_equal "Germany" form.sync loc.country.must_equal "Australia" # the writer wasn't called. hash = {} form.save do |nested| hash = nested end hash.must_equal("country"=> "Germany") end end
Version data entries
19 entries across 19 versions & 1 rubygems