Sha256: 81632e4f611acfb72352e4fffde66dc26a4f46908cc0b40dd06e13ef8300f342

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

require 'test_helper'

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

  class PasswordForm < Reform::Form
    property :password
    property :password_confirmation, :empty => true
  end

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

  it {
    form.validate("password" => "123", "password_confirmation" => "321")

    form.password.must_equal "123"
    form.password_confirmation.must_equal "321"

    form.sync
    cred.password.must_equal "123"

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reform-1.2.0.beta2 test/empty_test.rb
reform-1.2.0.beta1 test/empty_test.rb