mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Remove DiscourseEvent.clear
.
This commit is contained in:
parent
e0a2346b92
commit
aa9decf6fd
4 changed files with 5 additions and 17 deletions
|
@ -21,8 +21,4 @@ module DiscourseEvent
|
||||||
events[event_name].delete(block)
|
events[event_name].delete(block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.clear
|
|
||||||
@events = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,14 +16,6 @@ describe DiscourseEvent do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".clear" do
|
|
||||||
it "clears out events" do
|
|
||||||
DiscourseEvent.events["event42"] << "test event"
|
|
||||||
DiscourseEvent.clear
|
|
||||||
expect(DiscourseEvent.events).to be_empty
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when calling events' do
|
context 'when calling events' do
|
||||||
|
|
||||||
let(:harvey) {
|
let(:harvey) {
|
||||||
|
|
|
@ -14,10 +14,6 @@ describe DiscoursePlugin do
|
||||||
let(:registry) { mock }
|
let(:registry) { mock }
|
||||||
let(:plugin) { TestPlugin.new(registry) }
|
let(:plugin) { TestPlugin.new(registry) }
|
||||||
|
|
||||||
after do
|
|
||||||
DiscourseEvent.clear
|
|
||||||
end
|
|
||||||
|
|
||||||
describe ".mixins" do
|
describe ".mixins" do
|
||||||
it "finds its mixins" do
|
it "finds its mixins" do
|
||||||
expect(TestPlugin.mixins).to eq([TestPlugin::TestMixin])
|
expect(TestPlugin.mixins).to eq([TestPlugin::TestMixin])
|
||||||
|
@ -45,6 +41,10 @@ describe DiscoursePlugin do
|
||||||
plugin.listen_for(:hello)
|
plugin.listen_for(:hello)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
DiscourseEvent.off(:hello)
|
||||||
|
end
|
||||||
|
|
||||||
it "calls the method when it is triggered" do
|
it "calls the method when it is triggered" do
|
||||||
plugin.expects(:hello).with('there')
|
plugin.expects(:hello).with('there')
|
||||||
DiscourseEvent.trigger(:hello, 'there')
|
DiscourseEvent.trigger(:hello, 'there')
|
||||||
|
|
|
@ -56,7 +56,7 @@ describe Plugin::Instance do
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
DiscourseEvent.clear
|
DiscourseEvent.off(:hello)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "checks enabled/disabled functionality for extensions" do
|
it "checks enabled/disabled functionality for extensions" do
|
||||||
|
|
Loading…
Reference in a new issue