Sha256: 5d37d635029c39b8ce8d06ef27d1e6328f70d67f7d25838eaec6795fa46fe61b

Contents?: true

Size: 573 Bytes

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
reform-2.3.2 test/readable_test.rb
reform-2.3.1 test/readable_test.rb
reform-2.3.0.rc2 test/readable_test.rb