Use `self == other.source` in Decoratable#==
Apparently AR::Base does something tricky with #== which causes `super(other.source)` to break Closes #391
This commit is contained in:
parent
9eb9fc909c
commit
b83a95f0f0
|
@ -22,7 +22,7 @@ module Draper::Decoratable
|
|||
end
|
||||
|
||||
def ==(other)
|
||||
super || (other.respond_to?(:source) && super(other.source))
|
||||
super || (other.respond_to?(:source) && self == other.source)
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Post do
|
||||
describe "#==" do
|
||||
before { Post.create }
|
||||
subject { Post.first }
|
||||
|
||||
it "is true for other instances' decorators" do
|
||||
other = Post.first
|
||||
subject.should_not be other
|
||||
(subject == other.decorate).should be_true
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue