Fix Override. Properly define prepended

We should never be sloppy!
This commit is contained in:
Lin Jen-Shin 2018-08-30 19:51:32 +08:00
parent 71fefe1474
commit 517ee9fd04
2 changed files with 11 additions and 7 deletions

View file

@ -92,9 +92,13 @@ module Gitlab
queue_verification(base)
end
alias_method :prepended, :included
def prepended(base = nil)
super
def extended(mod)
queue_verification(base)
end
def extended(mod = nil)
super
queue_verification(mod.singleton_class)

View file

@ -23,7 +23,7 @@ describe Gitlab::Patch::Prependable do
this = self
prepended do
prepended_modules_ << this
prepended_modules_ << [self, this]
end
def name
@ -48,7 +48,7 @@ describe Gitlab::Patch::Prependable do
this = self
prepended do
prepended_modules_ << this
prepended_modules_ << [self, this]
end
def name
@ -71,7 +71,7 @@ describe Gitlab::Patch::Prependable do
subject
expect(prepended_modules).to eq([ee, ce])
expect(prepended_modules).to eq([[subject, ee], [subject, ce]])
end
end
@ -86,7 +86,7 @@ describe Gitlab::Patch::Prependable do
it 'prepends only once' do
subject.prepend(ce)
expect(prepended_modules).to eq([ee, ce])
expect(prepended_modules).to eq([[subject, ee], [subject, ce]])
end
end
@ -115,7 +115,7 @@ describe Gitlab::Patch::Prependable do
it 'prepends only once' do
subject.prepend(ee)
expect(prepended_modules).to eq([ee])
expect(prepended_modules).to eq([[subject, ee]])
end
end
end