Upgraded Rails and RSpec
[monkeycharger.git] / vendor / plugins / rspec / rspec / spec / spec / runner / formatter / failing_examples_formatter_spec.rb
blob257970335fe7901d6d7f3c63c9d43f6ee7c64a56
1 require File.dirname(__FILE__) + '/../../../spec_helper'
3 module Spec
4   module Runner
5     module Formatter
6       describe "FailingExamplesFormatter" do
7         before(:each) do
8           @io = StringIO.new
9           options = mock('options')
10           @formatter = FailingExamplesFormatter.new(options, @io)
11           @behaviour = Class.new(::Spec::Example::ExampleGroup).describe("Some Examples")
12         end
14         it "should add example name for each failure" do
15           @formatter.add_example_group("b 1")
16           @formatter.example_failed(@behaviour.it("e 1"), nil, Reporter::Failure.new(nil, RuntimeError.new))
17           @formatter.add_example_group("b 2")
18           @formatter.example_failed(@behaviour.it("e 2"), nil, Reporter::Failure.new(nil, RuntimeError.new))
19           @formatter.example_failed(@behaviour.it("e 3"), nil, Reporter::Failure.new(nil, RuntimeError.new))
20           @io.string.should eql(<<-EOF
21 b 1 e 1
22 b 2 e 2
23 b 2 e 3
24 EOF
26         end
27       end
28     end
29   end
30 end