Merge pull request #4514 from tgxworld/add_plugin_interface_to_register_a_seedfu_fixture
FEATURE: Add interface in `Plugin::Instance` to register a seedfu fix…
This commit is contained in:
commit
a6c62dbe73
|
@ -203,6 +203,11 @@ class Plugin::Instance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def register_seedfu_fixtures(paths)
|
||||||
|
paths = [paths] if !paths.kind_of?(Array)
|
||||||
|
SeedFu.fixture_paths.concat(paths)
|
||||||
|
end
|
||||||
|
|
||||||
def listen_for(event_name)
|
def listen_for(event_name)
|
||||||
return unless self.respond_to?(event_name)
|
return unless self.respond_to?(event_name)
|
||||||
DiscourseEvent.on(event_name, &self.method(event_name))
|
DiscourseEvent.on(event_name, &self.method(event_name))
|
||||||
|
|
|
@ -180,4 +180,15 @@ describe Plugin::Instance do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '.register_seedfu_fixtures' do
|
||||||
|
it "should add the new path to SeedFu's fixtures path" do
|
||||||
|
plugin = Plugin::Instance.new nil, "/tmp/test.rb"
|
||||||
|
plugin.register_seedfu_fixtures(['some_path'])
|
||||||
|
plugin.register_seedfu_fixtures('some_path2')
|
||||||
|
|
||||||
|
expect(SeedFu.fixture_paths).to include('some_path')
|
||||||
|
expect(SeedFu.fixture_paths).to include('some_path2')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue