[rspec-users] New, clueless, confused...and thinking JQuery+MongoID is breaking my template code examples...

Meltemi mdemetrios at gmail.com
Thu Feb 17 16:59:34 EST 2011

If this is the wrong forum for this type of question please let me
know...I don't want to ruffle any feathers...

I've been teaching myself RSpec and quite enjoying the 'new'
book...but as I try to put it into practice I get tripped up. Now,
this may not be RSpec's fault. I'm also relatively new to Rails and
MongoDB and HAML and...

I realize this is a long question but probably a very easy answer...if
you're familiar with all the pieces. Warning: it will probably require
downloading a really basic (1 scaffold) project from github so don't
bother reading further if you don't have the time or will...

That said. I'm just trying to get a stable platform from which to
'grow' upon. And as I slowly put together my 'kit' I watch my
boilerplate (template) specs at each turn. Now they're failing and I
want to know why before I continue. Seems reasonable...but I've
exhausted my resources...so looking for some insight.

Short of a "here's the answer to your problem and now the template
specs all pass" I'm also looking for approaches as to how to begin
troubleshooting this for myself. Failed specs are great and largely
informative but I'm not sure, yet, how to dig deeper...so though this
issue may not be RSpec's 'fault' I'd like to know how to interpret the
failures so I can uncover the 'failure'...if that makes any sense?!?

What I've done is create a new project:

$ rails new destroid -T -O    # yes, dumb name but initially my issue
was with resource_controller.spec.rb#destroy. And, in hindsight I
should probably have used the -J flag. though same "problem" seems to
exist regardless...

then installed RSpec and MongoID... (yes, built similar project w/out
MongoID and tests all pass...so I *think* MongoDB (or MongoID) may
have something to do with my problem though I don't know how/where and
won't see failures until after jquery:install)


$ rails g scaffold resource name:string

refactor the (also poorly named) controller (resources_controller.rb)
to utilize respond_with (resources_controller.rb.with). (though not
sure now that this has anything to do with it...though appeal of
respond_with is what's led me to dig into this issue).

$ rspec spec
tests all pass


$ rails generate jquery:install

and 3 of the template code examples now fail...and I'm not sure why?
If I switch back to the scaffold installed RESTful controller
(resources_controller.rb.default) the code examples *still* fail...so
issue apparently not (as I had originally thought) with

anyway, my code (useless project only for my troubleshooting purposes)
is on github <https://github.com/demetrios/destroid> should anyone who
is familiar with all these pieces want to help a poor sod learn a
thing or two...

it will require MongoID as with standard SQL there doesn't seem to be
a problem.


More information about the rspec-users mailing list