[rspec-users] rspec_autotest testing with the use of the controller Namespaces

Raecoo raecoo at gmail.com
Fri Dec 28 11:20:15 EST 2007

Rails2.0  the official support of namespace, making it easier for
people with the usual habit of definition Controller
For example,We define the following Controller
  this class namespace is Admin::HackController
When we use rspec_autotest for testing,Will be following error
  no such file to load -- ./spec/views/hacks/../../spec_helper (LoadError)

The wrong reason is very simple.
By default, rspec_autotest the loading path and does not take into
account the issue of naming space, so it is necessary to be loaded
their own.

There are two ways:
  First, edit documents in the corresponding Spec loading path

  require File.dirname(__FILE__) + '/../../spec_helper' ### here

  Another, add the overall load

  require File.expand_path(File.dirname(__FILE__) + "/../spec/spec_helper")

Two methods are very useful, but first some trouble.Choose your own
ways to use it

Best Wish For You


GTalk/Gmail: raecoo at gmail.com
MSN: caol at live.com

More information about the rspec-users mailing list