mirror of
https://github.com/elastic/logstash.git
synced 2025-04-23 22:27:21 -04:00
Replace the class declaration with let statements
Instead of using a concrete class use let statement instead, this make sure they are reset between run and make the variable available at the context level. Fixes #7017
This commit is contained in:
parent
9f2ce5d164
commit
a758412499
1 changed files with 6 additions and 7 deletions
|
@ -53,13 +53,12 @@ describe LogStash::Plugins::Registry do
|
|||
end
|
||||
|
||||
context "when loading plugin manually configured" do
|
||||
it "should return the plugin" do
|
||||
class SimplePlugin
|
||||
end
|
||||
let(:simple_plugin) { Class.new }
|
||||
|
||||
it "should return the plugin" do
|
||||
expect { registry.lookup("filter", "simple_plugin") }.to raise_error(LoadError)
|
||||
registry.add(:filter, "simple_plugin", SimplePlugin)
|
||||
expect(registry.lookup("filter", "simple_plugin")).to eq(SimplePlugin)
|
||||
registry.add(:filter, "simple_plugin", simple_plugin)
|
||||
expect(registry.lookup("filter", "simple_plugin")).to eq(simple_plugin)
|
||||
end
|
||||
|
||||
it "doesn't add multiple time the same plugin" do
|
||||
|
@ -74,9 +73,9 @@ describe LogStash::Plugins::Registry do
|
|||
end
|
||||
|
||||
it "allow you find plugin by type" do
|
||||
registry.add(:filter, "simple_plugin", SimplePlugin)
|
||||
registry.add(:filter, "simple_plugin", simple_plugin)
|
||||
|
||||
expect(registry.plugins_with_type(:filter)).to include(SimplePlugin)
|
||||
expect(registry.plugins_with_type(:filter)).to include(simple_plugin)
|
||||
expect(registry.plugins_with_type(:modules)).to match([])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue