Sha256: af3e7a9c5dd71d01c700778f10095d89c0c5aab13889e869ab8dede5aa6def2f
Contents?: true
Size: 652 Bytes
Versions: 8
Compression:
Stored size: 652 Bytes
Contents
require "test_helper" class DeprecationRemoveMePopulatorTest < MiniTest::Spec Album = Struct.new(:songs) Song = Struct.new(:title) class AlbumForm < Reform::Form collection :songs, populator: ->(fragment, collection, index, *) { return Representable::Pipeline::Stop if fragment[:title]=="Good" songs[index] } do property :title 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 form.songs[0].title.must_equal nil form.songs[1].title.must_equal "Bad" end end
Version data entries
8 entries across 8 versions & 1 rubygems