Sha256: 6de5315bbc3f9d973065d2506134b71b52883fa052df81b14aebd820eb5a6bbe

Contents?: true

Size: 517 Bytes

Versions: 19

Compression:

Stored size: 517 Bytes

Contents

require 'test_helper'

class VirtualTest < MiniTest::Spec
  class CreditCardForm < Reform::Form
    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

19 entries across 19 versions & 1 rubygems

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