Sha256: fb692189a340b88cb6087ab242a408f6ce3c964450e9cbbe411c98c9951a03a7

Contents?: true

Size: 1.51 KB

Versions: 31

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

require 'test_helper'

module Vedeu

  describe Plugin do

    let(:described) { Vedeu::Plugin }
    let(:instance)  { described.new(_name, _gem) }
    let(:_name)     {}
    let(:_gem)      {}

    describe '#initialize' do
      it { instance.must_be_instance_of(described) }
      it { instance.instance_variable_get('@name').must_equal(_name) }
      it { instance.instance_variable_get('@gem').must_equal(_gem) }
      it do
        instance.instance_variable_get('@gem_name').
          must_equal("vedeu_#{_name}")
      end
      it { instance.instance_variable_get('@enabled').must_equal(false) }
    end

    describe '#name' do
      it { instance.must_respond_to(:name) }
    end

    describe '#gem' do
      it { instance.must_respond_to(:gem) }
    end

    describe '#gem_name' do
      it { instance.must_respond_to(:gem_name) }
    end

    describe '#enabled' do
     it { instance.must_respond_to(:enabled) }
    end

    describe '#enabled=' do
      it { instance.must_respond_to(:enabled=) }
    end

    describe '#enabled?' do
      it { instance.must_respond_to(:enabled?) }
    end

    describe '#load!' do
      subject { instance.load! }

      context 'when the plugin gem cannot be loaded' do
        before do
          Kernel.stubs(:require).raises(LoadError)
        end

        it { proc { subject }.must_raise(Vedeu::Error::Fatal) }
        it { instance.enabled.must_equal(false) }
      end

      # @todo Add more tests.
      # it { skip }
    end

  end # Plugin

end # Vedeu

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
vedeu-0.8.32 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.31 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.30 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.29 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.28 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.27 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.26 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.25 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.24 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.23 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.22 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.21 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.20 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.19 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.18 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.17 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.16 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.15 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.14 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.8.13 test/lib/vedeu/plugins/plugin_test.rb