Sha256: 648457bfd27b8abf41d81f5b21f98afc652970986e95b465f2a98903b56324f1
Contents?: true
Size: 632 Bytes
Versions: 1
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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reform-2.3.0.rc1 | test/populator_skip_test.rb |