Sha256: 324573530969f512c7fc8d38b81693f2e0200fb75fd8b8b85d58e196164ba0a9

Contents?: true

Size: 869 Bytes

Versions: 5

Compression:

Stored size: 869 Bytes

Contents

require 'spec_helper'

module Locomotive
  module Plugin
    describe LoadInitialization do

      before(:each) do
        MyPlugin.instance_variable_set(:@done_load_inialization, false)
      end

      it 'should call plugin_loaded only once' do
        MyPlugin.custom_attribute.should_not == 'Value'

        MyPlugin.do_load_initialization
        MyPlugin.custom_attribute.should == 'Value'

        -> do
          MyPlugin.do_load_initialization
        end.should raise_error
      end

      it 'should call the given block' do
        expects(:initialization_code)

        MyPlugin.do_load_initialization do
          initialization_code
        end
      end

      it 'should not fail if no plugin_loaded method defined' do
        lambda do
          UselessPlugin.do_load_initialization
        end.should_not raise_error
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
locomotive_plugins-1.2.0 spec/lib/locomotive/plugin/load_initialization_spec.rb
locomotive_plugins-1.1.1 spec/lib/locomotive/plugin/load_initialization_spec.rb
locomotive_plugins-1.1.0 spec/lib/locomotive/plugin/load_initialization_spec.rb
locomotive_plugins-1.0.1 spec/lib/locomotive/plugin/load_initialization_spec.rb
locomotive_plugins-1.0.0.beta10 spec/lib/locomotive/plugin/load_initialization_spec.rb