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.71 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.70 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.69 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.68 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.67 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.66 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.65 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.64 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.63 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.62 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.61 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.60 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.59 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.58 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.57 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.56 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.54 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.53 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.52 test/lib/vedeu/plugins/plugin_test.rb
vedeu-0.6.51 test/lib/vedeu/plugins/plugin_test.rb