[rspec-users] concerned_with, and maybe require_dependency issues only when running specs?

Cameron Booth cameron.booth at gmail.com
Mon Nov 3 16:55:45 EST 2008

Hi all,

So in the interests of keeping a few areas of my code a bit under control,
I've been investigating the concept of "concerned_with" as described here:


Basically allowing me to have:

class User < ActiveRecord::Base
  concerned_with :something

class User < ActiveRecord::Base
  def something_method

I realize that there might be better ways to deal with this same
issue...some of my code might be better off in separate classes, or modules,
etc, but for now I'm hoping to try this out. And it's working working great
in my code, when I run the server, script/console, etc...

....everywhere except in my specs.

And, its working in my actual model spec just fine

But where it's not working is in other specs that end up using the user
model, such as some controller specs, and view specs where things aren't
fully stubbed/mocked out.

It seems like in those other specs, the User class doesn't have
"something_method" defined. (the failure message is undefined_method
"something_method" for #<Class:0x243626c>

Anybody have any ideas? I have a feeling it's related to require_dependency
or something, but I'm not really sure. I've turned on logging in
require_dependency, and it seems like the files are being required. Any help
would be great, thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081103/bff4c633/attachment.html>

More information about the rspec-users mailing list