Sha256: 8122063f2a07fbc3ca793727d3bec9e53e947b22f9f0be9ace6b9dc8511690c6

Contents?: true

Size: 831 Bytes

Versions: 6

Compression:

Stored size: 831 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module RSpec
    module PrimitiveMatchers
      module Classes
        class ExtendModule
          ##
          # NOTE: `mod` since `module` is a keyword.
          #
          def initialize(mod)
            @mod = mod
          end

          def matches?(klass)
            @klass = klass

            klass.singleton_class.included_modules.include?(mod)
          end

          def description
            "extend module `#{mod}`"
          end

          def failure_message
            "expected `#{klass}` to extend module `#{mod}`"
          end

          def failure_message_when_negated
            "expected `#{klass}` NOT to extend module `#{mod}`"
          end

          private

          attr_reader :klass, :mod
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/rspec/primitive_matchers/classes/extend_module.rb
convenient_service-0.19.0 lib/convenient_service/rspec/primitive_matchers/classes/extend_module.rb
convenient_service-0.18.0 lib/convenient_service/rspec/primitive_matchers/classes/extend_module.rb
convenient_service-0.17.0 lib/convenient_service/rspec/primitive_matchers/classes/extend_module.rb
convenient_service-0.16.0 lib/convenient_service/rspec/primitive_matchers/classes/extend_module.rb
convenient_service-0.15.0 lib/convenient_service/rspec/primitive_matchers/classes/extend_module.rb