On Thu, Mar 5, 2009 at 4:02 PM, mudphone <kyle...@gmail.com> wrote: > Hi folks, > > In order to bring some order to the many model classes that I have > under /app/models, I'm created a new directory (for example): > /app/models/nestdir > > I've added the required configuration line in environment.rb: > config.load_paths += %W( #{RAILS_ROOT}/app/models/nestdir ) > > But, when I run my specs, I get an error such as: > ... > dependencies.rb:428:in `load_missing_constant': Expected RAILS_ROOT/ > app/models/nestdir/my_model.rb to define Nestdir::MyModel (LoadError) > ... > > >From my understanding, the models in the dir listed in > config.load_paths should be available in the root Rails namespace. Is > this not how rspec handles things? > > Is there a standard way of setting up specs for nested model > directories? The models are not nested within a parent module (like > Nestdir, which would have matched the directory name).
I just created a fresh rails-2.3.0 app w/ the latest rspec (built from git - 1.1.99.11) and not only was able to include a nested model, I was able to run the specs under each of the following conditions: * neither spec nor model are namespaced describe User do end class User < ActiveRecord::Base end * model and spec are both namespaced module Admin describe User do end end module Admin class User < ActiveRecord::Base end end * config is modifed per your example above * config is NOT modifed per your example above What versions of rspec and rails are you using? > > Thanks, > Kyle > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users