Sha256: 28ce81eaacc70d9fcf6d24373dd9aefca06cf296ed30160822a1322aa517a923

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

require "test_helper"

class SkipGetterTest < MiniTest::Spec
  Album  = Struct.new(:title, :artist)
  Artist = Struct.new(:name)

  class AlbumTwin < Disposable::Twin
    feature Sync
    feature Sync::SkipGetter

    property :title
    property :artist do
      property :name

      def name
        super.upcase
      end
    end

    def title
      super.reverse
    end
  end

  it do
    album = Album.new("Wild Frontier", Artist.new("Gary Moore"))
    twin  = AlbumTwin.new(album)

    twin.title.must_equal "reitnorF dliW"
    twin.artist.name.must_equal "GARY MOORE"

    twin.sync # does NOT call getter.

    album.title.must_equal "Wild Frontier"
    album.artist.name.must_equal "Gary Moore"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
disposable-0.1.1 test/skip_getter_test.rb