Sha256: e0956c16c0004e14faec9f844de6927584fc07ffe3d6302e8abce95ceffd48f1

Contents?: true

Size: 900 Bytes

Versions: 14

Compression:

Stored size: 900 Bytes

Contents

# frozen_string_literal: true
module Mail
  module Matchers
    def any_attachment
      AnyAttachmentMatcher.new
    end

    def an_attachment_with_filename(filename)
      AttachmentFilenameMatcher.new(filename)
    end

    def an_attachment_with_mime_type(filename)
      AttachmentMimeTypeMatcher.new(filename)
    end

    class AnyAttachmentMatcher
      def ===(other)
        other.attachment?
      end
    end

    class AttachmentFilenameMatcher
      attr_reader :filename
      def initialize(filename)
        @filename = filename
      end

      def ===(other)
        other.attachment? && other.filename == filename
      end
    end

    class AttachmentMimeTypeMatcher
      attr_reader :mime_type
      def initialize(mime_type)
        @mime_type = mime_type
      end

      def ===(other)
        other.attachment? && other.mime_type == mime_type
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 5 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/matchers/attachment_matchers.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/mail-2.8.1/lib/mail/matchers/attachment_matchers.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/matchers/attachment_matchers.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/matchers/attachment_matchers.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/matchers/attachment_matchers.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/mail-2.8.1/lib/mail/matchers/attachment_matchers.rb
mail-2.8.1 lib/mail/matchers/attachment_matchers.rb
mail-2.8.1.rc2 lib/mail/matchers/attachment_matchers.rb
mail-2.8.0.1 lib/mail/matchers/attachment_matchers.rb
mail-2.8.0.1.rc1 lib/mail/matchers/attachment_matchers.rb
mail-2.8.0 lib/mail/matchers/attachment_matchers.rb
mail-2.8.0.rc3 lib/mail/matchers/attachment_matchers.rb
mail-2.8.0.rc2 lib/mail/matchers/attachment_matchers.rb
mail-2.8.0.rc1 lib/mail/matchers/attachment_matchers.rb