Sha256: f7e6144e49e99560cfb75bc8d4895fab28008e479a929450bc388203f024feae

Contents?: true

Size: 573 Bytes

Versions: 1

Compression:

Stored size: 573 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")

    form.password.must_equal "123"

    form.sync
    cred.password.must_equal "123" # password written.

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

    hash.must_equal("password"=> "123")
  }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reform-2.3.0.rc1 test/readable_test.rb