Sha256: 7b42b455a6a994a4db618a0e94b104355de0ba9e5d54a0d37e9cf5c9d42b3713

Contents?: true

Size: 1.06 KB

Versions: 1

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 plugin included block on MyClass" do
      assert_equal "another", subject.another
    end

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

    should "add the plugin 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

1 entries across 1 versions & 1 rubygems

Version Path
much-mixin-0.0.1 test/system/much-mixin_tests.rb