Sha256: 9b1df7acabe26f99910ffe3f1d12b8a3dae08eb04b622202b50cb6d84f8cdf9c

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 Bytes

Contents

require "test_helper"

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

  class SongForm < TestForm
    property :title

    validation do
      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_old_api.rb