Sha256: c0afee4f1c41b1fd47ec0323ce34e5aafc9b415d82ec93d6822f7b85ba55ac75

Contents?: true

Size: 581 Bytes

Versions: 19

Compression:

Stored size: 581 Bytes

Contents

require 'test_helper'

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

  class PasswordForm < Reform::Form
    property :password, readable: false
  end

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

  it {
    form.password.must_equal nil # 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

19 entries across 19 versions & 1 rubygems

Version Path
reform-2.2.4 test/readable_test.rb
reform-2.2.3 test/readable_test.rb
reform-2.2.2 test/readable_test.rb
reform-2.2.1 test/readable_test.rb
reform-2.2.0 test/readable_test.rb
reform-2.2.0.rc1 test/readable_test.rb
reform-2.1.0 test/readable_test.rb
reform-2.1.0.rc1 test/readable_test.rb
reform-2.0.5 test/readable_test.rb
reform-2.0.4 test/readable_test.rb
reform-2.0.3 test/readable_test.rb
reform-2.0.2 test/readable_test.rb
reform-2.0.1 test/readable_test.rb
reform-2.0.0 test/readable_test.rb
reform-2.0.0.rc3 test/readable_test.rb
reform-2.0.0.rc2 test/readable_test.rb
reform-2.0.0.rc1 test/readable_test.rb
reform-2.0.0.beta2 test/readable_test.rb
reform-2.0.0.beta1 test/readable_test.rb