Sha256: 4c2dee18d04079ad09b55c9bbb033c0f1b7d370e24e9995092128701c5862df1

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

Version Path
reform-2.3.3 test/call_new_api.rb