Hi all,
I hope I can get a quick pointer about the following problem:
I have a controller spec with 38 examples, all green if run from within TextMate.
From the shell, however (through either rake or autotest) I get a
handful of pink errors.
For example, I get a few TypeErrors (“can’t convert Note into Array”)
that appear to be raised while my index action is paginating records,
but I am obviously NOT asking help on the specific issue.
Rather, I’d like to know in general how to address such a discrepancy
between environments in the outcome of my tests.
I had a similar situation, only reversed. All ran with autotest, but
failed in Textmate. I found the problem was in how I was including
some helper modules and correcting that solved the problem.
I had a similar situation, only reversed. All ran with autotest, but
failed in Textmate. I found the problem was in how I was including
some helper modules and correcting that solved the problem.
right, I’ve heard about that before, and I thought that my problem may
be similar in nature, but I am currently at a loss.
Giuseppe,
autotest will run your tests in different order. It does this to catch
any dependencies your tests may have on each other in order to reveal
brittle tests.
catch any dependencies your tests may have on each other
in order to reveal brittle tests.
Following Ben’s hint, I took out examples from the controller spec until
I isolated the culprit.
Briefly, I am switching from RSpec’s built in mocking framework to Mocha
and fixture_scenarios when necessary. I had forgotten to modify one of
the examples, which still had this construct:
in /spec/spec_helper.rb and then mixing Mocha with RSpec’s own
mocking/stubbing messes things up in a nasty way, in the sense that
failures occur all over the place with error messages that did not help
me finding the bug.
And again, these errors were not raised by TextMate’s environment.
Tricky.
“Programming today is a race between software engineers striving to
build
bigger and better idiot-proof programs, and the Universe trying to
produce
bigger and better idiots. So far, the Universe is winning.”
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.