From ca7f1431d642508edcad460428b407bf84b21827 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Wed, 22 Jan 2014 07:59:31 +1100 Subject: [PATCH] cleanup --- lib/rspec/core/configuration.rb | 4 ++-- lib/rspec/core/formatters/html_printer.rb | 18 ++++++++---------- .../formatters/base_text_formatter_spec.rb | 2 +- .../core/formatters/json_formatter_spec.rb | 6 +----- spec/spec_helper.rb | 7 ------- 5 files changed, 12 insertions(+), 25 deletions(-) diff --git a/lib/rspec/core/configuration.rb b/lib/rspec/core/configuration.rb index 987f0dac0a..50bccb8471 100644 --- a/lib/rspec/core/configuration.rb +++ b/lib/rspec/core/configuration.rb @@ -293,7 +293,7 @@ def force(hash) def reset @spec_files_loaded = false @reporter = nil - @loader = nil + @formatter_loader = nil end # @overload add_setting(name) @@ -605,7 +605,7 @@ def formatters # @api private def formatter_loader @reporter ||= Reporter.new(self) - @loader ||= Formatters::Loader.new(reporter) + @formatter_loader ||= Formatters::Loader.new(reporter) end # @api private diff --git a/lib/rspec/core/formatters/html_printer.rb b/lib/rspec/core/formatters/html_printer.rb index 86936cc358..9cd6f5b0c8 100644 --- a/lib/rspec/core/formatters/html_printer.rb +++ b/lib/rspec/core/formatters/html_printer.rb @@ -19,18 +19,18 @@ def print_example_group_end @output.puts "" end - def print_example_group_start( group_id, description, number_of_parents ) + def print_example_group_start(group_id, description, number_of_parents) @output.puts "
" @output.puts "
" @output.puts "
#{h(description)}
" end - def print_example_passed( description, run_time ) + def print_example_passed(description, run_time) formatted_run_time = sprintf("%.5f", run_time) @output.puts "
#{h(description)}#{formatted_run_time}s
" end - def print_example_failed( pending_fixed, description, run_time, failure_id, exception, extra_content, escape_backtrace = false ) + def print_example_failed(pending_fixed, description, run_time, failure_id, exception, extra_content, escape_backtrace = false) formatted_run_time = sprintf("%.5f", run_time) @output.puts "
" @@ -50,11 +50,11 @@ def print_example_failed( pending_fixed, description, run_time, failure_id, exce @output.puts "
" end - def print_example_pending( description, pending_message ) + def print_example_pending(description, pending_message) @output.puts "
#{h(description)} (PENDING: #{h(pending_message)})
" end - def print_summary( was_dry_run, duration, example_count, failure_count, pending_count ) + def print_summary(duration, example_count, failure_count, pending_count) # TODO - kill dry_run? if was_dry_run totals = "This was a dry-run" @@ -78,7 +78,7 @@ def flush @output.flush end - def move_progress( percent_done ) + def move_progress(percent_done) @output.puts " " @output.flush end @@ -101,14 +101,12 @@ def make_example_group_header_yellow(group_id) @output.puts " " end + private - private - - def indentation_style( number_of_parents ) + def indentation_style(number_of_parents) "style=\"margin-left: #{(number_of_parents - 1) * 15}px;\"" end - REPORT_HEADER = <<-EOF
diff --git a/spec/rspec/core/formatters/base_text_formatter_spec.rb b/spec/rspec/core/formatters/base_text_formatter_spec.rb index caa6c8b483..08c012c8b9 100644 --- a/spec/rspec/core/formatters/base_text_formatter_spec.rb +++ b/spec/rspec/core/formatters/base_text_formatter_spec.rb @@ -363,7 +363,7 @@ def run_all_and_dump_pending config.tty = true config.success_color = :cyan end - send_notification :dump_summary, 0,1,0,0 + send_notification :dump_summary, 0, 1, 0, 0 expect(output.string).to include("\e[36m") end end diff --git a/spec/rspec/core/formatters/json_formatter_spec.rb b/spec/rspec/core/formatters/json_formatter_spec.rb index 2d1606e91b..a473481762 100644 --- a/spec/rspec/core/formatters/json_formatter_spec.rb +++ b/spec/rspec/core/formatters/json_formatter_spec.rb @@ -85,11 +85,7 @@ it "outputs the results as a JSON string" do expect(output.string).to eq "" send_notification :close - begin - JSON.parse(output.string) - rescue - fail "output was expected to be valid json" - end + expect(output.string).to eq("{}") end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cdb9ed1049..a7b197a2b8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -126,13 +126,6 @@ def without_env_vars(*vars) :file_path => /spec\/command_line/ } - # Use the doc formatter when running individual files. - # This is too verbose when running all spec files but - # is nice for a single file. - if c.files_to_run.one? && c.formatters.empty? - c.formatter = 'doc' - end - c.expect_with :rspec do |expectations| expectations.syntax = :expect end