Sha256: db4845fa17bf7aaf6294b86682e4a16535b8ba83950d4833aac98af26f083029

Contents?: true

Size: 581 Bytes

Versions: 4

Compression:

Stored size: 581 Bytes

Contents

require "test_helper"

class ReadableTest < MiniTest::Spec
  Credentials = Struct.new(:password)

  class PasswordForm < TestForm
    property :password, readable: false
  end

  let(:cred) { Credentials.new }
  let(:form) { PasswordForm.new(cred) }

  it {
    assert_nil form.password # password not read.

    form.validate("password" => "123")

    assert_equal form.password, "123"

    form.sync
    assert_equal cred.password, "123" # password written.

    hash = {}
    form.save do |nested|
      hash = nested
    end

    assert_equal hash, "password" => "123"
  }
end

Version data entries

4 entries across 4 versions & 1 rubygems

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