Sha256: acba318b00e4b7adf689792e7f3d55e36c82a1cbb21fae54838d5a3d24471ac6

Contents?: true

Size: 508 Bytes

Versions: 1

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")))
    _(form.song.title).must_equal "When It Comes To You"

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reform-2.3.3 test/form_option_new_api.rb