pending test-spec tests are considered as failed with 2.4.7 #22

Closed
boutil opened this Issue Mar 4, 2012 · 2 comments

Projects

None yet

2 participants

@boutil

Hi!

I just noticed that with test-unit 2.4.7 tests written with test-spec that have been disabled are now considered as failed:require "test/spec"

Here is a typical example:

describe "Foo" do
  xit "should be deactivated" do
    (1 + 4).should.equal 5
  end
end

gives the following output:

Loaded suite test-spec
Started
D
===============================================================================
Failure: 

E
===============================================================================
Error: test_spec {Foo} 001 [should be deactivated](Foo)
NoMethodError: undefined method `each_with_index' for nil:NilClass
/usr/lib/ruby/vendor_ruby/test/spec.rb:600:in `add_disabled'
     597:   class TestResult              # :nodoc:
     598:     # Records a disabled test.
     599:     def add_disabled(name)
  => 600:       notify_listeners(FAULT, Test::Spec::Disabled.new(name))
     601:       notify_listeners(CHANGED, self)
     602:     end  
     603:   end

/usr/lib/ruby/vendor_ruby/test/spec.rb:418:in `test_spec {Foo} 001 [should be deactivated]'
/usr/lib/ruby/vendor_ruby/test/spec.rb:580:in `run'
/usr/lib/ruby/vendor_ruby/test/spec.rb:579:in `each'
/usr/lib/ruby/vendor_ruby/test/spec.rb:579:in `run'
/usr/lib/ruby/vendor_ruby/test/spec.rb:580:in `run'
/usr/lib/ruby/vendor_ruby/test/spec.rb:579:in `each'
/usr/lib/ruby/vendor_ruby/test/spec.rb:579:in `run'
===============================================================================


Finished in 0.002148 seconds.

1 tests, 0 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
0% passed

465.55 tests/s, 0.00 assertions/s

2.4.6 is running fine. The problem seems to be caused by the
output_fault_backtrace(fault) statement l. 187 of lib/test/unit/ui/console/testrunner.rb

The disabled test has no fault location, so the each_with_index command in the definition of output_fault_backtrace is run on a NilClass object.

Cédric

@kou kou added a commit that closed this issue Mar 5, 2012
@kou kou Accept no backtrace fault as a workaround for test-spec :<
GitHub: fixes #22

Reported by Cédric Boutillier. Thanks!!!
2ead573
@kou kou closed this in 2ead573 Mar 5, 2012
@kou
test-unit member
kou commented Mar 5, 2012

I've added a workaround for it but it should be fixed in test-spec...
test-unit has API to add a new fault...

@boutil

Thank you! I have reported the issue to test-spec.
sinisterchipmunk/test-spec#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment