Sha256: 71abf82567dc151c77898e28394f3965d458352d4c31652ee1d27b8c738d3db9

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require "assert"
require "much-plugin"

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-plugin_tests.rb