Commit 43f0c0fc9f7091f56b5c183a7fe4e9d4f7acd565

Removed spec_path printing in errors because it is misleading on top of the stack trace. Its possible to get a stack track to the definition of the Example. Reporter::Failure takes an Example, instead of a description.

git-svn-id: http://rspec.rubyforge.org/svn/trunk@3306 410327ef-2207-0410-a325-f78bbcb22a5a

Commit diff

rspec/lib/spec/runner/formatter/failing_example_groups_formatter.rb

 
1616 description =~ /(.*) \(druby.*\)$/ ? $1 : description
1717 end
1818 @output.puts ::Spec::Example::ExampleGroupMethods.description_text(*description_parts)
19 @output.puts(example_group.spec_path) if example_group.spec_path
2019
2120 @output.flush
2221 @example_group = nil
toggle raw diff

rspec/lib/spec/runner/formatter/failing_examples_formatter.rb

 
66 class FailingExamplesFormatter < BaseTextFormatter
77 def example_failed(example, counter, failure)
88 @output.puts "#{example_group.description} #{example.description}"
9 @output.puts example_group.spec_path if example_group.spec_path
109 @output.flush
1110 end
1211
toggle raw diff

rspec/lib/spec/runner/reporter.rb

 
3434
3535 def failure(example, error)
3636 backtrace_tweaker.tweak_backtrace(error)
37 failure = Failure.new(example.__full_description, error)
37 failure = Failure.new(example, error)
3838 @failures << failure
3939 formatters.each do |f|
4040 f.example_failed(example, @failures.length, failure)
9090 index + 1
9191 end
9292 end
93
9394 def dump_pending
9495 formatters.each{|f| f.dump_pending}
9596 end
112112 end
113113
114114 class Failure
115 attr_reader :exception
115 attr_reader :example, :exception
116116
117 def initialize(example_name, exception)
118 @example_name = example_name
117 def initialize(example, exception)
118 @example = example
119119 @exception = exception
120120 end
121121
122122 def header
123123 if expectation_not_met?
124 "'#{@example_name}' FAILED"
124 "'#{example_name}' FAILED"
125125 elsif pending_fixed?
126 "'#{@example_name}' FIXED"
126 "'#{example_name}' FIXED"
127127 else
128 "#{@exception.class.name} in '#{@example_name}'"
128 "#{@exception.class.name} in '#{example_name}'"
129129 end
130130 end
131131
137137 @exception.is_a?(Spec::Expectations::ExpectationNotMetError)
138138 end
139139
140 protected
141 def example_name
142 @example.__full_description
143 end
140144 end
141145 end
142146 end
toggle raw diff

rspec/lib/spec/version.rb

 
66 TINY = 3
77 RELEASE_CANDIDATE = nil
88
9 BUILD_TIME_UTC = 20080213084613
9 BUILD_TIME_UTC = 20080213090704
1010
1111 STRING = [MAJOR, MINOR, TINY].join('.')
1212 TAG = "REL_#{[MAJOR, MINOR, TINY, RELEASE_CANDIDATE].compact.join('_')}".upcase.gsub(/\.|-/, '_')
toggle raw diff

rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb

 
2424 io.string.should include("b 2")
2525 end
2626
27 it "should add the spec path for each failure" do
28 example_group_1 = Class.new(ExampleGroup).describe("b 1", :spec_path => "/path/to/b/1")
29 example_group_2 = Class.new(ExampleGroup).describe("b 2", :spec_path => "/path/to/b/2")
30 formatter.add_example_group(example_group_1)
31 formatter.example_failed("e 1", nil, Reporter::Failure.new(nil, RuntimeError.new))
32 formatter.add_example_group(example_group_2)
33 formatter.example_failed("e 2", nil, Reporter::Failure.new(nil, RuntimeError.new))
34 io.string.should include("/path/to/b/1")
35 io.string.should include("/path/to/b/2")
36 end
37
3827 it "should delimit ExampleGroup superclass descriptions with :" do
3928 parent_example_group = Class.new(example_group).describe("Parent")
4029 child_example_group = Class.new(parent_example_group).describe("#child_method")
toggle raw diff

rspec/spec/spec/runner/formatter/failing_examples_formatter_spec.rb

 
2727EOF
2828)
2929 end
30
31 it "should add spec path for each failing Example that has a spec_path" do
32 example_group_1 = Class.new(ExampleGroup).describe("A", :spec_path => "/path/to/a")
33 example_group_2 = Class.new(example_group_1).describe("B", :spec_path => "/path/to/b")
34
35 @formatter.add_example_group(example_group_1)
36 @formatter.example_failed(example_group_1.it("a1"){}, nil, Reporter::Failure.new(nil, RuntimeError.new))
37 @formatter.add_example_group(example_group_2)
38 @formatter.example_failed(example_group_2.it("b2"){}, nil, Reporter::Failure.new(nil, RuntimeError.new))
39 @formatter.example_failed(example_group_2.it("b3"){}, nil, Reporter::Failure.new(nil, RuntimeError.new))
40 @io.string.should eql(<<-EOF
41A a1
42/path/to/a
43A B b2
44/path/to/b
45A B b3
46/path/to/b
47EOF
48)
49 end
5030 end
5131 end
5232 end
toggle raw diff

rspec_on_rails/lib/spec/rails/version.rb

 
11module Spec
22 module Rails
33 module VERSION #:nodoc:
4 BUILD_TIME_UTC = 20080213084613
4 BUILD_TIME_UTC = 20080213090704
55 end
66 end
77end
toggle raw diff