Sha256: e5ff5310cb3ce72ec8c9731b5728f76baa2d5c505d7187f62a3d0a1ad2a7e87b

Contents?: true

Size: 1.3 KB

Versions: 51

Compression:

Stored size: 1.3 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 {
        instance.instance_variable_get('@gem_name').
          must_equal("vedeu_#{_name}")
      }
      it { instance.instance_variable_get('@enabled').must_equal(false) }
    end

    describe 'accessors' do
      it {
        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

    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

51 entries across 51 versions & 1 rubygems

Version Path
vedeu-0.6.30 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.29 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.28 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.27 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.26 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.25 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.24 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.23 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.22 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.21 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.20 test/lib/vedeu/plugins/plugin_test.rb