Merge pull request #65 from chrisledet/master
Added #include? to DecoratedEnumerableProxy class
This commit is contained in:
commit
251ace9ce2
|
@ -127,7 +127,7 @@ module Draper
|
|||
#
|
||||
# @return [Boolean] true if other's model == self's model
|
||||
def ==(other)
|
||||
@model == other.model
|
||||
@model == (other.respond_to?(:model) ? other.model : other)
|
||||
end
|
||||
|
||||
def respond_to?(method, include_private = false)
|
||||
|
|
|
@ -215,6 +215,14 @@ describe Draper::Base do
|
|||
decorator = ProductDecorator.decorate(empty_collection)
|
||||
decorator.should be_blank
|
||||
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
|
||||
subject.respond_to?(:include?)
|
||||
subject.include?(member).should == true
|
||||
subject.include?(subject.first).should == true
|
||||
subject.include?(Product.new).should == false
|
||||
end
|
||||
end
|
||||
|
||||
describe "a sample usage with denies" do
|
||||
|
|
Loading…
Reference in New Issue