Sha256: c7a0a2d3e6c1636f2fb705a5e030a8060e66bad17380aff0685105f5b07d8139

Contents?: true

Size: 626 Bytes

Versions: 3

Compression:

Stored size: 626 Bytes

Contents

require "test_helper"

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

  class SongForm < TestForm
    property :title

    validation do
      params { required(:title).filled }
    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

3 entries across 3 versions & 1 rubygems

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