Sha256: 4c047c5272166b6cf418f94952064100cff8cfe1476eaec8ea05fe9c4e76823c

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'




# Include Inherit Module And Decorator Test
class SchemaTest < MiniTest::Spec
  module Genre
    include Representable
    property :genre
  end

  module LinkFeature
    def self.included(base)
      base.extend(Link)
    end

    module Link
      def link
      end
    end
  end


  module Module
    include Representable::Hash
    feature LinkFeature

    property :title
    property :label do # extend: LabelModule
      property :name
      link # feature

      property :location do
        property :city
        link # feature.
      end
    end

    property :album, :extend => lambda { raise "don't manifest me!" } # this is not an inline decorator, don't manifest it.


    include Genre # Schema::Included::included is called!
  end


  class InheritDecorator < Representable::Decorator
    include Representable::Hash

    include Module

    property :label, inherit: true do # decorator.rb:27:in `initialize': superclass must be a Class (Module given)
      property :city

      property :location, :inherit => true do
        property :city
      end
    end
  end


  class InheritFromDecorator < InheritDecorator
    property :label, inherit: true do
      collection :employees do
        property :name
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
representable-2.4.1 test-with-deprecations/blaaaaaaaa_test.rb
representable-2.4.0 test-with-deprecations/blaaaaaaaa_test.rb
representable-2.4.0.rc5 test-with-deprecations/blaaaaaaaa_test.rb
representable-2.4.0.rc4 test-with-deprecations/blaaaaaaaa_test.rb