This project is archived and is in readonly mode.
ActiveSupport::Testing::SetupAndTeardown::run_with_callbacks_and_mocha does not record Exceptions as test errors
Reported by Geoff Longman | January 9th, 2009 @ 04:38 PM | in 2.x
Rails 2.2.2 mocha gem installed
run this unit test
require "test_helper" class BugTest < ActiveSupport::TestCase def test_bug raise Exception, "this should have been a test error but wasn't" end end
rake test:units
test/unit/bugtest.rb:5:in test_bug': this should have been
a test error but wasn't (Exception)
from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:94:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit.rb:278
from test/unit/bugtest.rb:4
it appears that run_with_callbacks_and_mocha does not catch Exception (or the Passthrough exceptions) like run_with_callbacks_and_testunit does.
That means any thrown Exception or Subclass of Exception kills the test run, and thus breaks our continuous build.
I'm not in the know about why run_with_callbacks_and_mocha is written this way but it looks like bug to me.
Comments and changes to this ticket
-
Geoff Longman January 9th, 2009 @ 04:41 PM
formatting test case...
require "test_helper" class BugTest < ActiveSupport::TestCase def test_bug raise Exception, "this should have been a test error but wasn't" end end >> rake test:units
-
Geoff Longman January 9th, 2009 @ 09:05 PM
I should add that if mocha is not present the problem does not appear.
-
Pratik March 10th, 2009 @ 12:19 PM
- State changed from new to stale
Is this still an issue on the edge ?
-
CancelProfileIsBroken August 3rd, 2009 @ 02:30 PM
- Tag changed from 2.2.2, active_support, mocha, testing to 2.2.2, active_support, bugmash, mocha, testing
-
Arthur Zapparoli August 9th, 2009 @ 05:45 AM
not reproducible in 2-3-stable
created the bug_test.rb file above, and it reproduced a test Error, instead of killing the test run.
-
Rizwan Reza August 9th, 2009 @ 11:34 PM
- Tag changed from 2.2.2, active_support, bugmash, mocha, testing to 2.2.2, active_support, bugmash, invalid, mocha, testing
not reproducible
-1 Same as Arthur. I manually tested in a sample app.
-
José Valim August 9th, 2009 @ 11:35 PM
- Tag changed from 2.2.2, active_support, bugmash, invalid, mocha, testing to 2.2.2, active_support, invalid, mocha, testing
- State changed from stale to invalid
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>