[rspec-users] Gem tutorials / setting up rspec in a gem
ramon.tayag at gmail.com
Tue Mar 30 06:17:24 EDT 2010
A few days ago, I tried my hand at creating a gem. I've been putting it off
for a long time because of the lack of documentation (or the lack of my
Googling skills). When I search how to create gems with RSpec, I get pages
that talk about gem templates with the rspec option, as if that would solve
If there are no tutorials, maybe I could ask for your help in setting it up
for a gem:
I'm asking because it's a bit frustrating doing things by trial and error. A
lot of the problems I've come across were that the files that rspec-rails
loads for me aren't automatically available in the gem, so I have to
manually include it. It became a problem when I had to test an ActiveRecord
model, and worse when I had to test a controller. Currently, I'm stuck at
the point where "get", "put", "post", "delete" aren't available in the spec.
I asked about it in StackOverflow and got the
but it doesn't explain what I have to do to basically replicate those
What did I do?
As part of my trial and error process, I started including what rspec-rails
the REST actions don't seem to trigger an undefined error anymore, but now
there's another "uninitialized constant Rails". So.. before I go further,
maybe I'm approaching this wrong since I'm having such a difficult time.
What's the best way to go about this? Is there a way to maybe include Rails
and everything it has, for testing purposes? I know that you're supposed to
make gems framework agnostic but for brevity's sake (and for my own sanity)
I'm willing to make it very plugin-like for now. I've been reading and
researching for 3 days you see :)
Thanks, and I apologize for the novel!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users