spec/reporter_spec.rb in konacha-2.4.0 vs spec/reporter_spec.rb in konacha-2.5.0
- old
+ new
@@ -71,27 +71,10 @@
subject.process_mocha_event({'event' => 'test', 'type' => 'test'})
end
end
describe "#process_event" do
- describe "increments counts" do
- it "increments example count" do
- subject.process_event(:example_started)
- subject.example_count.should == 1
- end
-
- it "increments pending count" do
- subject.process_event(:example_pending)
- subject.pending_count.should == 1
- end
-
- it "increments failed count" do
- subject.process_event(:example_failed)
- subject.failure_count.should == 1
- end
- end
-
it "forwards the call on to the formatters" do
formatter.should_receive(:example_started).with('arg!')
subject.process_event(:example_started, 'arg!')
end
end
@@ -116,8 +99,46 @@
it "links up the parent correctly" do
suite = subject.update_or_create_object({'fullTitle' => 'suite'}, 'suite')
object = subject.update_or_create_object({'fullTitle' => 'suite awesome', 'parentFullTitle' => 'suite'}, 'test')
object.parent.should == suite
+ end
+ end
+
+ describe "#passed?" do
+ it 'passes if failure count is zero' do
+ subject.should be_passed
+ end
+
+ it 'does not pass if failure count is not zero' do
+ subject.stub(:failure_count => 1)
+ subject.should_not be_passed
+ end
+ end
+
+ context "counters" do
+ describe "#example_count" do
+ it "is 0 by default" do
+ subject.example_count.should be_zero
+ end
+
+ it "returns examples count" do
+ subject.stub(:examples => {:omg => :two, :examples => :wow})
+ subject.example_count.should == 2
+ end
+ end
+
+ describe "#pending_count" do
+ it "returns pending examples count" do
+ subject.stub(:examples => {:first => double(:pending? => true), :second => double(:pending? => false)})
+ subject.pending_count.should == 1
+ end
+ end
+
+ describe "#failure_count" do
+ it "returns failed examples count" do
+ subject.stub(:examples => {:first => double(:failed? => true), :second => double(:failed? => false)})
+ subject.failure_count.should == 1
+ end
end
end
end