Sha256: 68b60898af1328e008a1085b162ffdc13f2f6014ab3870a3231a0263bb73097a

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

# encoding: utf-8
require 'spec_helper'
require 'fedux_org_stdlib/gem_plugins/plugin_manager'

RSpec.describe GemPlugins::PluginManager do
  context '#load_plugins' do
    it 'loads available plugins' do
      manager = GemPlugins::PluginManager.new prefix: 'fedux_org_stdlib-fixtures-plugin_manager-'
      manager.disable_plugin 'plugin-no_load'
      manager.load_plugins

      expect('FeduxOrgStdlib::Fixtures::PluginManager::Plugin::Load').to be_defined
    end
  end
  
  context '#disable' do
    it 'disable plugin' do
      manager = GemPlugins::PluginManager.new prefix: 'fedux_org_stdlib-fixtures-plugin_manager-'
      manager.disable_plugin 'plugin-no_load'
      manager.load_plugins

      expect('FeduxOrgStdlib::Fixtures::PluginManager::Plugin::NoLoad').not_to be_defined
    end

    it 'outputs warning if plugin cannout be found' do
      manager = GemPlugins::PluginManager.new prefix: 'fedux_org_stdlib-fixtures-plugin_manager-'
      result = capture :stderr do
        manager.disable_plugin 'plugin-blub'
      end

      expect(result).to include 'plugin-blub'
    end
  end

  context '#to_s' do
    it 'has a string representation' do
      manager = GemPlugins::PluginManager.new prefix: 'fedux_org_stdlib-fixtures-plugin_manager-'
      manager.disable_plugin 'plugin-no_load'
      manager.load_plugins

      binding.pry
      expect(manager.to_s).to include 'plugin'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.7.17 spec/gem_plugins/plugin_manager_spec.rb
fedux_org-stdlib-0.7.16 spec/gem_plugins/plugin_manager_spec.rb