Sha256: 0496af94ee3d6d204a0b877f62586e1e3cc5517b27d4bc2a75b173b84b931406
Contents?: true
Size: 911 Bytes
Versions: 2
Compression:
Stored size: 911 Bytes
Contents
require "test_helper" class ProcessInlineTest < MiniTest::Spec Album = Struct.new(:artist, :composer, :recursive_composer) module InlineTwin end class RecursiveComposerTwin < Disposable::Twin property :composer, twin: self end class AlbumTwin < Disposable::Twin def self.process_inline!(inline_class, definition) inline_class.send :include, InlineTwin end property :artist do end property :composer, twin: ->{ ComposerTwin } property :recursive_composer, twin: RecursiveComposerTwin end class ComposerTwin < Disposable::Twin end it do twin = AlbumTwin.new(Album.new(Object, Object, OpenStruct.new(composer: OpenStruct.new(composer: nil)))) assert ! (twin.class < InlineTwin) assert (twin.artist.class < InlineTwin) assert ! (twin.composer.class < InlineTwin) twin.recursive_composer.composer.composer.must_equal nil end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
disposable-0.1.12 | test/twin/process_inline_test.rb |
disposable-0.1.11 | test/twin/process_inline_test.rb |