Sha256: a68bed98c92975531e9a07a66613feb9754a507cf8f2265d0cac472823b87e21

Contents?: true

Size: 616 Bytes

Versions: 1

Compression:

Stored size: 616 Bytes

Contents

require "test_helper"

class CallTest < Minitest::Spec
  Song = Struct.new(:title)

  class SongForm < TestForm
    property :title

    validation do
      key(:title).required
    end
  end

  let (:form) { SongForm.new(Song.new) }

  it { form.(title: "True North").success?.must_equal true }
  it { form.(title: "True North").failure?.must_equal false }
  it { form.(title: "").success?.must_equal false }
  it { form.(title: "").failure?.must_equal true }

  it { form.(title: "True North").errors.messages.must_equal({}) }
  it { form.(title: "").errors.messages.must_equal({:title=>["must be filled"]}) }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reform-2.3.0.rc1 test/call_test.rb