[rspec-users] spec_helper por rails plugin

Borja Martín borjam at dagi3d.net
Tue Aug 24 12:58:58 EDT 2010


Hi,
I'm trying to write the specs for a rails plugin.
The thing is that I don't want to include in my specs the spec_helper
generated for the rails application as it will load the whole application
stack and will force me to include all the necessary gems in my plugin
Gemfile when it is supposed to be independent of the other installed
plugins.
So, I wrote my own spec_helper which loads only the required gems:
https://gist.github.com/6498b1c0ab4b286d03b0
Now the problem is that when I run the rake spec task I get this error:

Failure/Error: describe FacebookController do
     undefined method `env_defaults' for nil:NilClass
     # spec/fbrails/fbrails_spec.rb:6

This error appears only when I call the methods related to the
controller(controller, get, post, request, etc.) so I guess it has something
to do with the fact that the rails application hasn't been initialized as
opossed as when the application spec_helper is loaded
Is there any way to make the specs as much as indenpendent as possible so I
don't have to init the entire application?
Thanks in advance

Regards
-- 
def dagi3d(me)
  case me
    when :web then  "http://dagi3d.net"
    when :twitter then "http://twitter.com/dagi3d"
  end
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100824/61b59897/attachment.html>


More information about the rspec-users mailing list