Sha256: 0aa426822dbef962a453b7df87dc4a9fa787417586c685cca6a0f8478df632f5

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require "assert"
require "much-mixin"

module MuchMixin
  class SystemTests < Assert::Context
    desc "MuchMixin"
    setup do
      @my_class = MyClass.new
    end
    subject{ @my_class }

    should "class eval the mix-in included block on MyClass" do
      assert_equal "another", subject.another
    end

    should "add the mix-in class methods to MyClass" do
      assert_equal "a-class-method", MyClass.a_class_method
    end

    should "add the mix-in instance methods to MyClass" do
      assert_equal "an-instance-method", subject.an_instance_method
    end

    module AnotherMixin
      def another
        "another"
      end
    end

    module MyMuchMixin
      include MuchMixin

      mixin_included do
        include AnotherMixin
      end

      mixin_class_methods do
        def a_class_method
          "a-class-method"
        end
      end

      mixin_instance_methods do
        def an_instance_method
          "an-instance-method"
        end
      end
    end

    class MyClass
      include MyMuchMixin
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
much-mixin-0.2.5 test/system/much-mixin_tests.rb
much-mixin-0.2.4 test/system/much-mixin_tests.rb
much-mixin-0.2.3 test/system/much-mixin_tests.rb