Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Jan 23, 2014
1 parent db71169 commit ca7f143
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 25 deletions.
4 changes: 2 additions & 2 deletions lib/rspec/core/configuration.rb
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
18 changes: 8 additions & 10 deletions lib/rspec/core/formatters/html_printer.rb
Expand Up @@ -19,18 +19,18 @@ def print_example_group_end
@output.puts "</div>"
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 "<div id=\"div_group_#{group_id}\" class=\"example_group passed\">"
@output.puts " <dl #{indentation_style(number_of_parents)}>"
@output.puts " <dt id=\"example_group_#{group_id}\" class=\"passed\">#{h(description)}</dt>"
end

def print_example_passed( description, run_time )
def print_example_passed(description, run_time)
formatted_run_time = sprintf("%.5f", run_time)
@output.puts " <dd class=\"example passed\"><span class=\"passed_spec_name\">#{h(description)}</span><span class='duration'>#{formatted_run_time}s</span></dd>"
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 " <dd class=\"example #{pending_fixed ? 'pending_fixed' : 'failed'}\">"
Expand All @@ -50,11 +50,11 @@ def print_example_failed( pending_fixed, description, run_time, failure_id, exce
@output.puts " </dd>"
end

def print_example_pending( description, pending_message )
def print_example_pending(description, pending_message)
@output.puts " <dd class=\"example not_implemented\"><span class=\"not_implemented_spec_name\">#{h(description)} (PENDING: #{h(pending_message)})</span></dd>"
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"
Expand All @@ -78,7 +78,7 @@ def flush
@output.flush
end

def move_progress( percent_done )
def move_progress(percent_done)
@output.puts " <script type=\"text/javascript\">moveProgressBar('#{percent_done}');</script>"
@output.flush
end
Expand All @@ -101,14 +101,12 @@ def make_example_group_header_yellow(group_id)
@output.puts " <script type=\"text/javascript\">makeYellow('example_group_#{group_id}');</script>"
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
<div class="rspec-report">
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/formatters/base_text_formatter_spec.rb
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions spec/rspec/core/formatters/json_formatter_spec.rb
Expand Up @@ -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

Expand Down
7 changes: 0 additions & 7 deletions spec/spec_helper.rb
Expand Up @@ -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
Expand Down

0 comments on commit ca7f143

Please sign in to comment.