Sha256: a9e6768416d20631efb86352c1b538965399f752c1f71175f4073bc26f553e10

Contents?: true

Size: 499 Bytes

Versions: 6

Compression:

Stored size: 499 Bytes

Contents

require 'test_helper'

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

  class SongForm < Reform::Form
    property :title
    validation do
      key(:title).required
    end
  end

  class AlbumForm < Reform::Form
    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

6 entries across 6 versions & 1 rubygems

Version Path
reform-2.2.4 test/form_option_test.rb
reform-2.2.3 test/form_option_test.rb
reform-2.2.2 test/form_option_test.rb
reform-2.2.1 test/form_option_test.rb
reform-2.2.0 test/form_option_test.rb
reform-2.2.0.rc1 test/form_option_test.rb