Remove `DiscourseEvent.clear`.

This commit is contained in:
Guo Xiang Tan 2016-09-05 15:15:26 +08:00
parent e0a2346b92
commit aa9decf6fd
4 changed files with 5 additions and 17 deletions

View File

@ -21,8 +21,4 @@ module DiscourseEvent
events[event_name].delete(block)
end
def self.clear
@events = nil
end
end

View File

@ -16,14 +16,6 @@ describe DiscourseEvent do
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
let(:harvey) {

View File

@ -14,10 +14,6 @@ describe DiscoursePlugin do
let(:registry) { mock }
let(:plugin) { TestPlugin.new(registry) }
after do
DiscourseEvent.clear
end
describe ".mixins" do
it "finds its mixins" do
expect(TestPlugin.mixins).to eq([TestPlugin::TestMixin])
@ -45,6 +41,10 @@ describe DiscoursePlugin do
plugin.listen_for(:hello)
end
after do
DiscourseEvent.off(:hello)
end
it "calls the method when it is triggered" do
plugin.expects(:hello).with('there')
DiscourseEvent.trigger(:hello, 'there')

View File

@ -56,7 +56,7 @@ describe Plugin::Instance do
end
after do
DiscourseEvent.clear
DiscourseEvent.off(:hello)
end
it "checks enabled/disabled functionality for extensions" do