Sha256: 02a49a11dcc056ef60103266bde74d5d5993acafda3c83adb50ae772727a2296

Contents?: true

Size: 846 Bytes

Versions: 17

Compression:

Stored size: 846 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module RSpec
    module Matchers
      module Custom
        class PrependModule
          ##
          # NOTE: `mod` since `module` is a keyword.
          #
          def initialize(mod)
            @mod = mod
          end

          def matches?(klass)
            @klass = klass

            klass.ancestors.take_while { |ancestor| ancestor != klass }.include?(mod)
          end

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

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

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

          private

          attr_reader :klass, :mod
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
convenient_service-0.14.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.13.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.12.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.11.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.10.1 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.10.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.9.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.8.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.7.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.6.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.5.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.4.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.3.1 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.3.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.2.1 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.2.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb
convenient_service-0.1.0 lib/convenient_service/rspec/matchers/custom/prepend_module.rb