Skip to content

Commit

Permalink
rename internal key
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Nov 25, 2010
1 parent 190f8c8 commit cc9f8c9
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/rspec/core/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def start(reporter)

def finish(reporter)
if @exception
record_finished 'failed', :exception_encountered => @exception
record_finished 'failed', :exception => @exception
reporter.example_failed self
false
elsif @pending_declared_in_example
Expand Down
6 changes: 3 additions & 3 deletions lib/rspec/core/formatters/base_text_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,21 @@ def format_caller(caller_info)
end

def dump_backtrace(example)
format_backtrace(example.execution_result[:exception_encountered].backtrace, example).each do |backtrace_info|
format_backtrace(example.execution_result[:exception].backtrace, example).each do |backtrace_info|
output.puts grey("#{long_padding}# #{backtrace_info}")
end
end

def dump_pending_example_fixed(example, index)
if RSpec::Core::PendingExampleFixedError === example.execution_result[:exception_encountered]
if RSpec::Core::PendingExampleFixedError === example.execution_result[:exception]
output.puts "#{short_padding}#{index.next}) #{example.full_description} FIXED"
output.puts blue("#{long_padding}Expected pending '#{example.metadata[:execution_result][:pending_message]}' to fail. No Error was raised.")
true
end
end

def dump_failure(example, index)
exception = example.execution_result[:exception_encountered]
exception = example.execution_result[:exception]
output.puts "#{short_padding}#{index.next}) #{example.full_description}"
output.puts "#{long_padding}#{red("Failure/Error:")} #{red(read_failed_line(exception, example).strip)}"
exception.message.split("\n").each { |line| output.puts "#{long_padding}#{red(line)}" }
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/core/formatters/documentation_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def example_pending(example)

def example_failed(example)
super(example)
output.puts failure_output(example, example.execution_result[:exception_encountered])
output.puts failure_output(example, example.execution_result[:exception])
end

def failure_output(example, exception)
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/core/formatters/html_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def example_passed(example)

def example_failed(example)
counter = 0
exception = example.metadata[:execution_result][:exception_encountered]
exception = example.metadata[:execution_result][:exception]
extra = extra_failure_content(exception)
failure_style = 'failed'
failure_style = RSpec::Core::PendingExampleFixedError === exception ? 'pending_fixed' : 'failed'
Expand Down
10 changes: 5 additions & 5 deletions spec/rspec/core/example_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ module RSpec::Core
example = group.example("equality") { 1.should == 2}
group.run

example.metadata[:execution_result][:exception_encountered].message.should == "error in before each"
example.metadata[:execution_result][:exception].message.should == "error in before each"
end

it "treats an error in before(:all) as a failure" do
Expand All @@ -385,8 +385,8 @@ module RSpec::Core

example.metadata.should_not be_nil
example.metadata[:execution_result].should_not be_nil
example.metadata[:execution_result][:exception_encountered].should_not be_nil
example.metadata[:execution_result][:exception_encountered].message.should == "error in before all"
example.metadata[:execution_result][:exception].should_not be_nil
example.metadata[:execution_result][:exception].message.should == "error in before all"
end

it "treats an error in before(:all) as a failure for a spec in a nested group" do
Expand All @@ -402,8 +402,8 @@ module RSpec::Core

example.metadata.should_not be_nil
example.metadata[:execution_result].should_not be_nil
example.metadata[:execution_result][:exception_encountered].should_not be_nil
example.metadata[:execution_result][:exception_encountered].message.should == "error in before all"
example.metadata[:execution_result][:exception].should_not be_nil
example.metadata[:execution_result][:exception].message.should == "error in before all"
end

context "when an error occurs in an after(:all) hook" do
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

group.run

example.metadata[:execution_result][:exception_encountered].message.should == "FOO"
example.metadata[:execution_result][:exception].message.should == "FOO"
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/rspec/core/formatters/documentation_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ module RSpec::Core::Formatters
examples = [
double("example 1",
:description => "first example",
:execution_result => {:status => 'failed', :exception_encountered => Exception.new }
:execution_result => {:status => 'failed', :exception => Exception.new }
),
double("example 2",
:description => "second example",
:execution_result => {:status => 'failed', :exception_encountered => Exception.new }
:execution_result => {:status => 'failed', :exception => Exception.new }
)
]

Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/pending_example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def failure_reason(example, exception_klass)
case
when example.metadata[:pending] then "was pending"
when result[:status] != 'failed' then result[:status]
when !result[:exception_encountered].is_a?(exception_klass) then "failed with a #{result[:exception_encountered].class}"
when !result[:exception].is_a?(exception_klass) then "failed with a #{result[:exception].class}"
else nil
end
end
Expand Down

0 comments on commit cc9f8c9

Please sign in to comment.