CouchRest::Model views errors with RSpec
The latest CouchRest::Model Views (on 2.0.0.beta) aren't implicitly resolved when should
is invoked on them.
For instance if I do:
dossier.documents.should be_empty
Dossier's documents at this point is not an instance of Array
but of CouchRest::Model::Designs::View
that means it doesn't behave like you might expect. One solution is to call all
before of should
, but I didn't liked the idea of changing tons of specs in this way.
I decided to add a little, dirty trick here:
CouchRest::Model::Designs::View.class_eval do
def should(*args)
all.should(*args)
end
end
Written by Luca Guidi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#