gma / tconsole

Testing console for Rails. Helps out with test performance and also makes it easier to run specific tests
177 stars 18 forks source link

mocha methods not available within tconsole #54

Closed gma closed 12 years ago

gma commented 12 years ago

I've got tconsole running my tests now, but any of them that use mocha's stub method fail with this error:

  1) Error:
test_0001_should_not_expose_private_attributes(CardPresenter):
NoMethodError: undefined method `stub' for #<#<Class:0x007f9ef42ef0c8>:0x007f9ef43f4950>
    /Users/graham/Projects/planner/test/presenters/card_presenter_test.rb:17:in `model_with_attribute'
    /Users/graham/Projects/planner/test/presenters/card_presenter_test.rb:21:in `block (2 levels) in <top (required)>'`

I wondered if it might be because those tests are in test/presenters which isn't covered by a file set, so I created this .tconsole file:

TConsole::Config.run do |config|
   config.file_sets.merge(
     'presenters' => ['test/presenters/**/*_test.rb']
   )
 end

The tests still don't pass. They pass with no problem when run from the command line with bundle exec ruby.... I launched tconsole with bundle exec too.

The tests that are failing should definitely be able to find mocha; their test_helper.rb file requires mocha explicitly.

nalanj commented 12 years ago

Mocha's running fine for me in a simple test case. Do you have :require => false in your Gemfile on mocha so that it's loaded at the right time?

gma commented 12 years ago

No, I'd missed that. Ooops. All tests are passing now thanks!

nalanj commented 12 years ago

:metal: Awesome!