Merge pull request #26 from michaelfairley/master
Delegate == to the decorated models
This commit is contained in:
commit
475a8d1da5
|
@ -126,6 +126,13 @@ module Draper
|
||||||
@model
|
@model
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Delegates == to the decorated models
|
||||||
|
#
|
||||||
|
# @return [Boolean] true if other's model == self's model
|
||||||
|
def ==(other)
|
||||||
|
@model == other.model
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def select_methods
|
def select_methods
|
||||||
specified = self.allowed || (model.public_methods.map{|s| s.to_sym} - denied.map{|s| s.to_sym})
|
specified = self.allowed || (model.public_methods.map{|s| s.to_sym} - denied.map{|s| s.to_sym})
|
||||||
|
|
|
@ -132,6 +132,13 @@ describe Draper::Base do
|
||||||
end
|
end
|
||||||
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
|
describe "a sample usage with denies" do
|
||||||
let(:subject_with_denies){ DecoratorWithDenies.new(source) }
|
let(:subject_with_denies){ DecoratorWithDenies.new(source) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue