Sha256: a8d7bb1cb34b3f6dc8f7ae9d1246a1d3e596a4a978d8bf95c349ff1a2ba532f8

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'
require 'cantango/registry/shared/hash_ex'

class MyEngine < CanTango::Engine
end

class MyOtherEngine < CanTango::Engine
end


describe CanTango::Config::Engines do
  subject { CanTango.config.engines }

  describe 'execution order' do
    before do
      subject.set_execution_order :my_other_engine, :engine, :my_engine, :my_other_engine
    end

    its(:execution_order) { should == ['my_other_engine', 'my_engine'] }
  end

  describe 'excute_first' do
    before do
      subject.set_execution_order :my_other_engine, :my_engine
      subject.execute_first :my_engine
    end

    its(:execution_order) { should == ['my_engine', 'my_other_engine'] }
  end

  describe 'execute_last' do
    before do
      subject.set_execution_order :my_other_engine, :my_engine
      subject.execute_last :my_other_engine
    end

    its(:execution_order) { should == ['my_engine', 'my_other_engine'] }
  end

  describe 'execute_before' do
    before do
      subject.set_execution_order :my_other_engine, :my_engine
      subject.execute_before :my_other_engine, :my_engine
    end

    its(:execution_order) { should == ['my_engine', 'my_other_engine'] }
  end

  describe 'execute_after' do
    before do
      subject.set_execution_order :my_other_engine, :my_engine
      subject.execute_after :my_engine, :my_other_engine, 
    end

    its(:execution_order) { should == ['my_engine', 'my_other_engine'] }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cantango-config-0.2.1 spec/cantango/config/engines/order_spec.rb
cantango-config-0.2.0 spec/cantango/config/engines/order_spec.rb