lib/minitest/reporters/html_reporter.rb in minitest-reporters-1.1.2 vs lib/minitest/reporters/html_reporter.rb in minitest-reporters-1.1.3

- old
+ new

@@ -50,25 +50,28 @@ # The constructor takes a hash, and uses the following keys: # :title - the title that will be used in the report, defaults to 'Test Results' # :reports_dir - the directory the reports should be written to, defaults to 'test/html_reports' # :erb_template - the path to a custom ERB template, defaults to the supplied ERB template # :mode - Useful for debugging, :terse suppresses errors and is the default, :verbose lets errors bubble up + # :output_filename - the report's filename, defaults to 'index.html' def initialize(args = {}) super({}) defaults = { - :title => 'Test Results', - :erb_template => "#{File.dirname(__FILE__)}/../templates/index.html.erb", - :reports_dir => 'test/html_reports', - :mode => :safe + :title => 'Test Results', + :erb_template => "#{File.dirname(__FILE__)}/../templates/index.html.erb", + :reports_dir => 'test/html_reports', + :mode => :safe, + :output_filename => 'index.html' } settings = defaults.merge(args) @mode = settings[:mode] @title = settings[:title] @erb_template = settings[:erb_template] + @output_filename = settings[:output_filename] reports_dir = settings[:reports_dir] @reports_path = File.absolute_path(reports_dir) puts "Emptying #{@reports_path}" @@ -80,10 +83,10 @@ def report super begin puts "Writing HTML reports to #{@reports_path}" - html_file = @reports_path + "/index.html" + html_file = "#{@reports_path}/#{@output_filename}" erb_str = File.read(@erb_template) renderer = ERB.new(erb_str) tests_by_suites = tests.group_by(&:class) # taken from the JUnit reporter