1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00

Delegate == to the decorated models

This commit is contained in:
Michael Fairley 2011-09-19 10:44:16 -07:00
parent 62d80310f4
commit d1f2eceb79
2 changed files with 14 additions and 0 deletions

View file

@ -125,6 +125,13 @@ module Draper
@model
end
# Delegates == to the decorated models
#
# @return [Boolean] true if other's model == self's model
def ==(other)
@model == other.model
end
private
def select_methods
specified = self.allowed || (model.public_methods.map{|s| s.to_sym} - denied.map{|s| s.to_sym})

View file

@ -132,6 +132,13 @@ describe Draper::Base do
end
end
context('.==') do
it "should compare the decorated models" do
other = Draper::Base.new(source)
subject.should == other
end
end
describe "a sample usage with denies" do
let(:subject_with_denies){ DecoratorWithDenies.new(source) }