Sha256: 3b5d9dfc914e29590954ac1f820b2f7b73789bf30573ffe6e4ddd597d49f95ac
Contents?: true
Size: 632 Bytes
Versions: 3
Compression:
Stored size: 632 Bytes
Contents
require "test_helper" class PopulatorSkipTest < MiniTest::Spec Album = Struct.new(:songs) Song = Struct.new(:title) class AlbumForm < TestForm collection :songs, populator: :my_populator do property :title end def my_populator(options) return skip! if options[:fragment][:title] == "Good" songs[options[:index]] end end it do form = AlbumForm.new(Album.new([Song.new, Song.new])) hash = {songs: [{title: "Good"}, {title: "Bad"}]} form.validate(hash) form.songs.size.must_equal 2 assert_nil form.songs[0].title form.songs[1].title.must_equal "Bad" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reform-2.3.2 | test/populator_skip_test.rb |
reform-2.3.1 | test/populator_skip_test.rb |
reform-2.3.0.rc2 | test/populator_skip_test.rb |