Sha256: 2f61f37d5ce4db1873b79025c487dec81fb55756600edff4c359da3b216ec99d

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

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

RSpec.describe GemPlugins::PluginManager do
  module FeduxOrgStdlib
    module Fixtures
      module PluginManager
        module Load
          class PluginManager < GemPlugins::PluginManager
          end
        end
      end
    end
  end

  context '#activate_plugin' do
    it 'loads available plugins by its name' do
      FeduxOrgStdlib::Fixtures::PluginManager::Load::PluginManager.new

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

    it 'loads available plugins only on request' do
      manager = FeduxOrgStdlib::Fixtures::PluginManager::Load::PluginManager.new
      manager.activate_plugin 'fedux_org_stdlib-fixtures-plugin_manager-load'

      expect('FeduxOrgStdlib::Fixtures::PluginManager::Plugin::Load').to be_defined
    end
  end

  it 'outputs warning if plugin cannout be found' do
    manager = FeduxOrgStdlib::Fixtures::PluginManager::Load::PluginManager.new

    result = capture :stderr do
      manager.activate_plugin 'plugin-blub'
    end

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

  context '#to_s' do
    it 'has a string representation' do
      manager = FeduxOrgStdlib::Fixtures::PluginManager::Load::PluginManager.new
      manager.activate_plugin 'fedux_org_stdlib-fixtures-plugin_manager-load'

      expect(manager.to_s).to include '1 row in set'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.7.33 spec/gem_plugins/plugin_manager_spec.rb