Sha256: 69fc49127b350cfd8d1672468fae537a1e7db71bd537cb02613b0aa33fec2e0a

Contents?: true

Size: 1.11 KB

Versions: 31

Compression:

Stored size: 1.11 KB

Contents

require 'kontena/plugin_manager'

describe Kontena::PluginManager::Common do
  let(:subject) { described_class }

  context '#prefix' do
    it 'converts vagrant to kontena-plugin-vagrant' do
      expect(subject.prefix('vagrant')).to eq 'kontena-plugin-vagrant'
    end

    it 'returns the same if the string is already prefixed' do
      expect(subject.prefix('kontena-plugin-vagrant')).to eq 'kontena-plugin-vagrant'
    end
  end

  context '#installed' do
    before(:each) do
      allow(subject).to receive(:plugins).and_return([double(name: 'kontena-plugin-foo'), double(name: 'kontena-plugin-bar')])
    end

    it 'returns an installed spec by name' do
      expect(subject.installed('bar').name).to eq 'kontena-plugin-bar'
    end

    it 'returns nothing if not found' do
      expect(subject.installed('baz')).to be_nil
    end

    context '#installed?' do
      it 'returns true if the plugin is installed' do
        expect(subject.installed?('bar')).to be_truthy
      end

      it 'returns false if the plugin is not installed' do
        expect(subject.installed?('baz')).to be_falsey
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
kontena-cli-1.5.4 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.4.rc1 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.3 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.2 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.1 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.0 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.0.rc1 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.0.pre5 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.0.pre4 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.0.pre3 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.0.pre2 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.5.0.pre1 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.4.3 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.4.3.rc1 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.4.2 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.4.2.rc1 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.4.2.pre1 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.4.1 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.4.1.rc1 spec/kontena/plugin_manager/common_spec.rb
kontena-cli-1.4.1.pre1 spec/kontena/plugin_manager/common_spec.rb