Mocha is required by setup_and_teardown.rb in all environments and modes
Reported by Chad Humphries | June 12th, 2008 @ 04:57 PM | in 2.2
The following code snippet is where it happens. Mocha becomes available in all environments, and also in script/console, script/server, etc.
begin
require 'mocha'
base.alias_method_chain :run, :callbacks_and_mocha
rescue LoadError
base.alias_method_chain :run, :callbacks
end
This could cause other testing frameworks or even test/unit tests to encounter problems as mocha will be included along side whatever mocking framework the user actually is using. This doesn't seem to cause any issues currently, but it definitely should be cleaned up.
Comments and changes to this ticket
-
Jeremy Kemper June 12th, 2008 @ 05:43 PM
- → Assigned user changed from to Jeremy Kemper
- → Milestone changed from to 2.1.1
- → State changed from new to open
True. We could gem 'mocha' instead and rescue Gem::LoadError instead.
-

Repository June 23rd, 2008 @ 04:56 AM
- → State changed from open to resolved
(from [8636df7b5572b996cee0bfb59f9804825b3030d2]) Check for mocha gem without requiring the lib. [#403 state:resolved]
-

Repository June 23rd, 2008 @ 04:56 AM
(from [4d5ac3f3d2e1667971752c9a4e536de1a5bec364]) Check for mocha gem without requiring the lib. [#403 state:resolved]
-

Repository June 23rd, 2008 @ 08:39 AM
(from [642b0e95122c6f748ba0575e6dd3e2eccf34509c]) Revert "Check for mocha gem without requiring the lib. [#403 state:resolved]"
This reverts commit 8636df7b5572b996cee0bfb59f9804825b3030d2.
-

Repository June 23rd, 2008 @ 08:39 AM
(from [d7462ea36550bd59cfbcd7961f5870c49bcf8963]) Revert "Check for mocha gem without requiring the lib. [#403 state:resolved]"
This reverts commit 4d5ac3f3d2e1667971752c9a4e536de1a5bec364.
-
Jeremy Kemper June 23rd, 2008 @ 08:44 AM
- → State changed from resolved to incomplete
Messes up the setup/teardown override. Since mocha isn't required before it's mixed in.
-
Jeremy Kemper June 23rd, 2008 @ 08:44 AM
- → Milestone changed from 2.1.1 to 2.2
-
John July 3rd, 2008 @ 02:14 AM
- → Tag changed from to activesupport bug tests
This actually is causing problems transitioning our app up to 2.1, just mentioning it so this isn't just treated as a "tidy up" issue.
If I come up with a solution that isn't halfway hackish I'll submit a patch.
-
Joshua Peek October 5th, 2008 @ 03:14 PM
- → State changed from incomplete to wontfix
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Source available from github
The Git repository resides at http://github.com/rails
Check out the current development trunk (Edge Rails) with:
git clone git://github.com/rails/rails.git
Creating or reviewing a patch
See the contributor guide.
Creating a feature request
Please don't. If you want a new feature in Rails, you'll have to pull up your sleeves and get busy yourself. Or convince someone else to do it. See the contributor guide on how to get going. But posting them here is just going to lead to ticket root.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.
Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too".
