module Cucumber::Glue::ProtoWorld
def attach(file, media_type = nil, filename = nil)
-
filename
(string
) -- the name of the file you wish to specify. -
media_type
(string
) -- the media type. -
file
(string|io
) -- the file to attach.
def attach(file, media_type = nil, filename = nil) return super unless File.file?(file) content = File.read(file, mode: 'rb') media_type = MiniMime.lookup_by_filename(file)&.content_type if media_type.nil? super(content, media_type.to_s, filename) rescue StandardError super end