Giuseppe Bertini
2008-Apr-15 15:20 UTC
[rspec-users] textmate => pass, autotest => failing specs ???
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 ahandful 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. Thanks heaps! Giuseppe -- Posted via http://www.ruby-forum.com/.
Matt Berther
2008-Apr-15 17:02 UTC
[rspec-users] textmate => pass, autotest => failing specs ???
HI Giuseppe, 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. On Tue, Apr 15, 2008 at 9:20 AM, Giuseppe Bertini <lists at ruby-forum.com> wrote:> 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. > > Thanks heaps! > Giuseppe > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Matt Berther http://www.mattberther.com
Giuseppe Bertini
2008-Apr-15 17:34 UTC
[rspec-users] textmate => pass, autotest => failing specs ???
Hi Matt,> 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. Thanks, Giuseppe -- Posted via http://www.ruby-forum.com/.
Ben Mabey
2008-Apr-15 18:08 UTC
[rspec-users] textmate => pass, autotest => failing specs ???
Giuseppe Bertini wrote:> Hi Matt, > > >> 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. > > Thanks, > Giuseppe >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. For more info see: http://blog.zenspider.com/archives/2008/01/zentest_390_now_with_more_evil.html -Ben
Giuseppe Bertini
2008-Apr-15 19:27 UTC
[rspec-users] textmate => pass, autotest => failing specs ???
> 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: object.should_receive(:method).and_return(:a_mock) instead of Mocha''s: object.expects(:method).returns(:a_mock) So I have empirically learned that enabling config.mock_with :mocha 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. Thanks for the feedback! Giuseppe -- Posted via http://www.ruby-forum.com/.
Bryan Ray
2008-Apr-15 22:23 UTC
[rspec-users] textmate => pass, autotest => failing specs ???
That''ll learn ya to use Mocha over rSpec ;) On Tue, Apr 15, 2008 at 2:27 PM, Giuseppe Bertini <lists at ruby-forum.com> wrote:> > 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: > > object.should_receive(:method).and_return(:a_mock) > > instead of Mocha''s: > > object.expects(:method).returns(:a_mock) > > So I have empirically learned that enabling > > config.mock_with :mocha > > 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. > > > Thanks for the feedback! > Giuseppe > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Bryan Ray http://www.bryanray.net "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." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080415/896704e0/attachment.html