Sha256: 16ce95fff9b3c9fde309d104fa72e8a1485a35c5d51e93e624727b5c06d8ff2e

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

require "test_helper"

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

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

2 entries across 2 versions & 1 rubygems

Version Path
reform-2.2.4 test/call_test.rb
reform-2.2.3 test/call_test.rb