Sha256: 7794c856855b238516ad603a5bc3943fc2ac8f3d6bd11d22113c2580f949e6b6

Contents?: true

Size: 737 Bytes

Versions: 9

Compression:

Stored size: 737 Bytes

Contents

require 'test_helper'
require 'tins/concern'

module Tins
  class ConcernTest < Test::Unit::TestCase
    module ConcernTroll
      extend ::Tins::Concern[:complain => true]

      included do
        @included = :included
        @options  = tins_concern_args.first
      end

      module ClassMethods
        def class_foo
          :class_foo
        end
      end

      def foo
        :foo
      end
    end

    class Troll
      include ConcernTroll
    end

    def test_concern
      assert_equal :class_foo, Troll.class_foo
      assert_equal :foo, Troll.new.foo
      assert_equal :included, Troll.instance_variable_get(:@included)
      assert_equal true, Troll.instance_variable_get(:@options)[:complain]
    end
  end
end

Version data entries

9 entries across 8 versions & 3 rubygems

Version Path
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tins-0.13.2/tests/concern_test.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tins-0.13.2/tests/concern_test.rb
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/tins-0.13.2/tests/concern_test.rb
tdiary-5.0.8 vendor/bundle/gems/tins-0.13.2/tests/concern_test.rb
tins-0.13.2 tests/concern_test.rb
social_url_stats-0.0.1 vendor/ruby/1.9.1/gems/tins-0.13.1/tests/concern_test.rb
tins-0.13.1 tests/concern_test.rb
tins-0.13.0 tests/concern_test.rb
tins-0.12.0 tests/concern_test.rb