Permalink
Browse files

add negative test to spec summary loggger

  • Loading branch information...
1 parent 04d4d0b commit 04ecd6c28e34e3962248c519dbe3889b90ce816e @grosser grosser committed Nov 16, 2011
Showing with 16 additions and 15 deletions.
  1. +15 −15 spec/parallel_specs/spec_summary_logger_spec.rb
  2. +1 −0 spec/spec_helper.rb
@@ -8,23 +8,23 @@ def puts(s)
end
end
- before :each do
- @output = OutputLogger.new([])
- @example1 = mock( 'example', :location => '/my/spec/path/to/example:123', :description => 'should do stuff' )
- @example2 = mock( 'example', :location => '/my/spec/path/to/example2:456', :description => 'should do other stuff' )
- @exception1 = mock( :to_s => 'exception', :backtrace => [ '/path/to/error/line:33' ] )
- @failure1 = mock( 'example', :location => '/path/to/example:123', :header => 'header', :exception => @exception1 )
- end
-
- before :each do
- @logger = ParallelSpecs::SpecSummaryLogger.new( @output )
- end
+ let(:output){ OutputLogger.new([]) }
+ let(:logger){ ParallelSpecs::SpecSummaryLogger.new(output) }
it "should print a summary of failing examples" do
- @logger.example_failed( @example1 )
-
- @logger.dump_failure
+ logger.example_failed mock(:location => '/my/spec/path/to/example:123', :description => 'should do stuff')
+ logger.example_failed mock(:location => '/my/spec/path/to/example:125', :description => 'should not do stuff')
+ logger.dump_failure
+ output.output.should == [
+ "bundle exec rspec ./spec/path/to/example -e \"should do stuff\"",
+ "bundle exec rspec ./spec/path/to/example -e \"should not do stuff\""
+ ]
+ end
- @output.output.should == ["bundle exec rspec ./spec/path/to/example -e \"should do stuff\""]
+ it "does not print anything for passing examples" do
+ logger.example_started
+ logger.example_passed mock(:location => "/my/spec/foo.rb:123")
+ logger.dump_failure
+ output.output.should == []
end
end
View
@@ -7,6 +7,7 @@
require 'tempfile'
require 'parallel_specs'
require 'parallel_specs/spec_runtime_logger'
+require 'parallel_specs/spec_summary_logger'
require 'parallel_cucumber'
def mocked_process

0 comments on commit 04ecd6c

Please sign in to comment.