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) events[event_name].delete(block)
end end
def self.clear
@events = nil
end
end end

View file

@ -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) {

View file

@ -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')

View file

@ -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