Sha256: b14a0a873dae004556ebbf42a1a57e30beaf0a033d3b5aa4d45aae08f2ef086d

Contents?: true

Size: 508 Bytes

Versions: 4

Compression:

Stored size: 508 Bytes

Contents

require "test_helper"

class FormOptionTest < MiniTest::Spec
  Song  = Struct.new(:title)
  Album = Struct.new(:song)

  class SongForm < TestForm
    property :title
    validation do
      params { required(:title).filled }
    end
  end

  class AlbumForm < TestForm
    property :song, form: SongForm
  end

  it do
    form = AlbumForm.new(Album.new(Song.new("When It Comes To You")))
    assert_equal "When It Comes To You", form.song.title

    form.validate(song: {title: "Run For Cover"})
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reform-2.6.2 test/form_option_test.rb
reform-2.6.1 test/form_option_test.rb
reform-2.6.0 test/form_option_test.rb
reform-2.5.0 test/form_option_test.rb