Sha256: f3836189a1989b205e7e21d4873f391458e5116755e76943062a86f976c93942

Contents?: true

Size: 513 Bytes

Versions: 1

Compression:

Stored size: 513 Bytes

Contents

require 'test_helper'

class VirtualTest < MiniTest::Spec
  class CreditCardForm < TestForm
    property :credit_card_number, virtual: true # no read, no write, it's virtual.
  end

  let (:form) { CreditCardForm.new(Object.new) }

  it {
    form.validate("credit_card_number" => "123")

    form.credit_card_number.must_equal "123"  # this is still readable in the UI.

    form.sync

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

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