Sha256: 4f391d167ccfde7de69ea2d4d599d8584ac3621d4466494e2eb31ea656a1a2fb

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

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 'accessors' do
      it do
        instance.must_respond_to(:name)
        instance.must_respond_to(:gem)
        instance.must_respond_to(:gem_name)
        instance.must_respond_to(:enabled)
        instance.must_respond_to(:enabled=)
        instance.must_respond_to(:enabled?)
      end
    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

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.7.4 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.7.3 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.7.2 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.7.1 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.7.0 test/lib/vedeu/plugins/plugin_test.rb