In 2.0.1, ActionController(or ActionMailer)::TestCase had a problem
where inherited classes would break the setup method. The remedy for
that problem is to call super in your custom setup method. I submitted
a patch for ActionMailer, and somebody else submitted one for
ActionController.
http://dev.rubyonrails.org/ticket/10406
http://dev.rubyonrails.org/ticket/10382
In 2.0.2, overriding setup in a TestCase inherited from one of those
classes doesn't have any effect at all. Without shoulda's contexts +
setup blocks, you can't define any setup for your controller/mailer
tests.
http://dev.rubyonrails.org/changeset/8392
How they released code that breaks the _setup_ method in TestCases is
baffling. They seem to be ignoring our patches that would solve the
problem, for whatever reason. Go +1 them if this is bugging you (it's
driving me totally nuts as you may have guessed).
In the meantime, inherit from Test::Unit::TestCase, and test your
controller the normal way.
I've run across this problem in rails 2.0.2 I checked out the tickets
but there is not a lot there to say whether this was fixed or not.
Do you guys know if it was fixed? I can't believe they would release
with this kind of mistake.
On Dec 24 2007, 12:01am, Zach <google....@zachholman.com> wrote:
> Yeah, I've been following those tickets too, so I was on the right
> track at least. I'll follow along and see if it gets updated here in
> the future. In the meantime, I've gone with what you've suggested and
> inherited from Test::Unit::TestCase and it appears to be working as
> intended... thanks!
>
> Zach
>