-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add #decorated? method to Draper::CollectionDecorator #447
Comments
I do like as many things as possible to be similar between the collection decorators and the regular decorators! The one problem is that for a decorator, we can have model.decorated? # => false
Decorator.new(model).decorated? # => true Unfortunately for a collection decorator, we don't have a way of implementing a [].decorated? # => NoMethodError
CollectionDecorator.new([]).decorated? # => true I don't think the method is as useful without its counterpart. However, I'm not completely opposed to adding it, because if you write a spec like expect(products).to be_decorated it will still fail when the subject is not decorated, although less gracefully! |
hm yes. i think that in this case it will not be a problem if the source object doesn't have the Does this have a chance to be merged if i do it? |
I would give it a 👍 - @steveklabnik? |
Yeah, seems fine to me. The test case is compelling. |
Hi,
when i want to check if an object is decorated i call
#decorated?
and it will inform me. This is really useful when testing.But when i have a
Draper::CollectionDecorator
i can't do this.What do you think about add the
#decorated?
method on collections too?If you think this useful, i can try to make it works.
The text was updated successfully, but these errors were encountered: