added #include? to DecoratedEnumerableProxy class
This commit is contained in:
parent
03bf0b9af8
commit
064ac47bdd
|
@ -22,6 +22,10 @@ module Draper
|
||||||
super || @wrapped_collection.respond_to?(method)
|
super || @wrapped_collection.respond_to?(method)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def include?(member)
|
||||||
|
@wrapped_collection.include?(member)
|
||||||
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
"#<DecoratedEnumerableProxy of #{@klass} for #{@wrapped_collection.inspect}>"
|
"#<DecoratedEnumerableProxy of #{@klass} for #{@wrapped_collection.inspect}>"
|
||||||
end
|
end
|
||||||
|
|
|
@ -215,6 +215,14 @@ describe Draper::Base do
|
||||||
decorator = ProductDecorator.decorate(empty_collection)
|
decorator = ProductDecorator.decorate(empty_collection)
|
||||||
decorator.should be_blank
|
decorator.should be_blank
|
||||||
end
|
end
|
||||||
|
it "should return whether the member is in the array for a decorated wrapped collection" do
|
||||||
|
# This tests that include? is defined for the DecoratedEnumerableProxy
|
||||||
|
member = paged_array.first
|
||||||
|
decorator = ProductDecorator.decorate(paged_array)
|
||||||
|
decorator.respond_to?(:include?)
|
||||||
|
decorator.include?(member).should == true
|
||||||
|
decorator.include?(Product.new).should == false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "a sample usage with denies" do
|
describe "a sample usage with denies" do
|
||||||
|
|
Loading…
Reference in New Issue