features/support/env.rb in xcpretty-0.1.6 vs features/support/env.rb in xcpretty-0.1.7
- old
+ new
@@ -9,10 +9,11 @@
require 'rexml/document'
require 'lib/xcpretty/formatters/formatter'
require 'lib/xcpretty/reporters/junit'
require 'lib/xcpretty/reporters/html'
require 'lib/xcpretty/reporters/json_compilation_database'
+
begin
require 'json'
rescue LoadError
require 'vendor/json_pure/parser'
end
@@ -89,10 +90,15 @@
@custom_report_file2 = Tempfile.new('custom_report_path')
@custom_report_file2.path
end
end
+def copy_file_to_screenshot_dir(screenshot_file)
+ @screenshot_file_path = "#{XCPretty::HTML::SCREENSHOT_DIR}/#{screenshot_file}"
+ FileUtils.cp("features/assets/#{screenshot_file}", @screenshot_file_path)
+end
+
Before do
self.colorize = true
end
After do
@@ -103,6 +109,7 @@
@html_report = nil
@json = nil
FileUtils.rm_rf(XCPretty::JUnit::FILEPATH)
FileUtils.rm_rf(XCPretty::HTML::FILEPATH)
FileUtils.rm_rf(XCPretty::JSONCompilationDatabase::FILEPATH)
+ File.delete(@screenshot_file_path) if @screenshot_file_path
end