Sha256: a9d185d955ab3e274e4768f0ea63e34884cef295b613dd6d8a1f7a26af80587b

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 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

3 entries across 3 versions & 1 rubygems

Version Path
reform-2.3.2 test/form_option_new_api.rb
reform-2.3.1 test/form_option_new_api.rb
reform-2.3.0.rc2 test/form_option_new_api.rb