Sha256: 79da377f6e1412077848f0f4cb00cbbcf393f353ae541b235660eaa70e1f8b9a

Contents?: true

Size: 592 Bytes

Versions: 4

Compression:

Stored size: 592 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 { assert form.(title: "True North").success? }
  it { refute form.(title: "True North").failure? }
  it { refute form.(title: "").success? }
  it { assert form.(title: "").failure? }

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reform-2.6.2 test/call_test.rb
reform-2.6.1 test/call_test.rb
reform-2.6.0 test/call_test.rb
reform-2.5.0 test/call_test.rb