Sha256: b07096aad3e78e27093d1f4db0b80f481e43e080d0e72bc286c2f29b65e1f6f6
Contents?: true
Size: 820 Bytes
Versions: 5
Compression:
Stored size: 820 Bytes
Contents
require 'test_helper' class VirtualTest < MiniTest::Spec class CreditCardTwin < Disposable::Twin include Sync property :credit_card_number, virtual: true # no read, no write, it's virtual. end let (:twin) { CreditCardTwin.new(Object.new) } it { twin.credit_card_number = "123" twin.credit_card_number.must_equal "123" # this is still readable in the UI. twin.sync hash = {} twin.sync do |nested| hash = nested end hash.must_equal("credit_card_number"=> "123") } describe "setter should never be called with virtual:true" do class Raising < Disposable::Twin property :id, virtual: true def id=(*) raise "i should never be called!" end end it "what" do Raising.new(Object.new).id.must_equal nil end end end
Version data entries
5 entries across 5 versions & 1 rubygems