<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV>I've recently upgraded to the latest versions of Mocha and RSpec (0.3.2 and 0.6.3 respectively) and I'm no longer able to use Mocha/Stubba with RSpec. Its actually only Stubba I'm interested in as I use RSpec's built-in mocking library.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I require stubba in my spec file but whenever I try and run my spec it fails with the error:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Unintialized constant Test</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Digging around the Mocha source, it seems that it is trying to add extensions to Test::Unit which I haven't required as I don't need it.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>This isn't a Rails project, just a standalone Ruby lib that I'm working on.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I've tried the obvious solution of requiring test/unit but that has its own issues (i.e. it puts test::unit output at the bottom of my spec output) and it still doesn't work, I get a new error:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Undefined method 'stub' for nil:NilClass</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Here's the line where I'm trying to stub a method on an existing instance of an object:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>@connection.stubs(:logged_in?).returns(true)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I've x-posted this to the Mocha dev list and RSpec dev list as I'm not sure where the issue lies.</DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>Cheers,</DIV><DIV>Luke Redpath</DIV><DIV><A href="mailto:contact@lukeredpath.co.uk">contact@lukeredpath.co.uk</A></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>