lib/allure-ruby-api/builder.rb in allure-ruby-api-0.4 vs lib/allure-ruby-api/builder.rb in allure-ruby-api-0.5
- old
+ new
@@ -72,10 +72,10 @@
def add_attachment(suite, test, opts = {:step => nil, :file => nil, :mime_type => nil})
raise "File cannot be nil!" if opts[:file].nil?
step = opts[:step]
file = opts[:file]
title = opts[:title] || file.basename
- puts "Adding attachment #{opts[:title]} to #{suite}.#{test}#{step.nil ? "" : ".#{step}"}"
+ puts "Adding attachment #{opts[:title]} to #{suite}.#{test}#{step.nil? ? "" : ".#{step}"}"
dir = Pathname.new(config.output_dir)
FileUtils.mkdir_p(dir)
file_extname = File.extname(file.path.downcase)
mime_type = opts[:mime_type] || MimeMagic.by_path(file.path) || "text/plain"
attachment = dir.join("#{Digest::SHA256.file(file.path).hexdigest}-attachment#{(file_extname.empty?) ? '' : file_extname}")
\ No newline at end of file