Remove obsolete/duplicate code
This commit is contained in:
parent
7ac940f226
commit
66e1d83268
|
@ -155,6 +155,7 @@ module Draper
|
||||||
def kind_of?(klass)
|
def kind_of?(klass)
|
||||||
super || model.kind_of?(klass)
|
super || model.kind_of?(klass)
|
||||||
end
|
end
|
||||||
|
alias :is_a? :kind_of?
|
||||||
|
|
||||||
def respond_to?(method, include_private = false)
|
def respond_to?(method, include_private = false)
|
||||||
super || (allow?(method) && model.respond_to?(method))
|
super || (allow?(method) && model.respond_to?(method))
|
||||||
|
@ -175,11 +176,6 @@ module Draper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def kind_of?(klass)
|
|
||||||
model.kind_of?(klass) || super(klass)
|
|
||||||
end
|
|
||||||
alias :is_a? :kind_of?
|
|
||||||
|
|
||||||
def self.method_missing(method, *args, &block)
|
def self.method_missing(method, *args, &block)
|
||||||
model_class.send(method, *args, &block)
|
model_class.send(method, *args, &block)
|
||||||
end
|
end
|
||||||
|
|
|
@ -423,12 +423,6 @@ describe Draper::Base do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "decorator in cancan rules" do
|
|
||||||
it "should answer yes to kind_of? source class" do
|
|
||||||
subject.kind_of?(source.class).should == true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#method_missing" do
|
describe "#method_missing" do
|
||||||
context "when #hello_world is called for the first time" do
|
context "when #hello_world is called for the first time" do
|
||||||
it "hits method missing" do
|
it "hits method missing" do
|
||||||
|
@ -448,20 +442,20 @@ describe Draper::Base do
|
||||||
|
|
||||||
describe "#kind_of?" do
|
describe "#kind_of?" do
|
||||||
context "pretends to be of kind of model class" do
|
context "pretends to be of kind of model class" do
|
||||||
it "#kind_of? Decorator" do
|
it "#kind_of? decorator class" do
|
||||||
subject.should be_kind_of Decorator
|
subject.should be_kind_of subject.class
|
||||||
end
|
end
|
||||||
|
|
||||||
it "#is_a? Decorator" do
|
it "#is_a? decorator class" do
|
||||||
subject.is_a?(Decorator).should be_true
|
subject.is_a?(subject.class).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it "#kind_of? Product" do
|
it "#kind_of? source class" do
|
||||||
subject.should be_kind_of Product
|
subject.should be_kind_of source.class
|
||||||
end
|
end
|
||||||
|
|
||||||
it "#is_a? Product" do
|
it "#is_a? source class" do
|
||||||
subject.is_a?(Product).should be_true
|
subject.is_a?(source.class).should be_true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue