On 31 May 2011, at 19:09, Ken Egervari wrote:
I have a module that extends ActiveSupport::Concern. Here is the
has_many :taggings, :as => :taggable
has_many :tags, :through => :taggings
How can I stub out these calls? I have tried a few ways, but Ruby complains that
these methods don’t exist when I try and test the module in isolation.
I’ve never used concerns, but my guess is that they carry shared
responsibility that’s mixed into a few other classes. If you want to
test them in isolation (as opposed to just testing the behaviour of the
actual classes you’ve mixed them in to) then I would create a simple
dummy object in your test, mix the concern into that, and then test the
behaviour of that object.
rspec-users mailing list