Sha256: cf3e103786e117a6fea7d0297ef8a7023f393c22d526662289bda12457558938

Contents?: true

Size: 693 Bytes

Versions: 24

Compression:

Stored size: 693 Bytes

Contents

require 'spec_helper'
require 'cuba_api/config'
require 'cuba_api/write_aspect'

module Plugin
  def one( obj, opts )
    obj + "-one"
  end
  def two( obj, opts )
    obj + "-two"
  end
  def three( obj, opts )
    obj + "-three"
  end
end

describe CubaApi::WriteAspect do

  before do
    Cuba.plugin CubaApi::Config
    Cuba.plugin CubaApi::WriteAspect
    Cuba.plugin Plugin
    Cuba.append_aspect :one
    Cuba.prepend_aspect :two
    Cuba.append_aspect :three
    Cuba.define do
      on true do
        write 'start'
      end
    end
  end

  
  it 'should execute aspects in the right order' do
     _, _, resp = Cuba.call({})
    
    resp.must.eq ["start-two-one-three"]
  end
end

Version data entries

24 entries across 12 versions & 1 rubygems

Version Path
cuba-api-0.6.3 spec/config_spec.rb~
cuba-api-0.6.3 spec/aspects_spec.rb~
cuba-api-0.6.2 spec/config_spec.rb~
cuba-api-0.6.2 spec/aspects_spec.rb~
cuba-api-0.6.1 spec/aspects_spec.rb~
cuba-api-0.6.1 spec/config_spec.rb~
cuba-api-0.6.0 spec/config_spec.rb~
cuba-api-0.6.0 spec/aspects_spec.rb~
cuba-api-0.5.1 spec/config_spec.rb~
cuba-api-0.5.1 spec/aspects_spec.rb~
cuba-api-0.5.0 spec/aspects_spec.rb~
cuba-api-0.5.0 spec/config_spec.rb~
cuba-api-0.4.0 spec/config_spec.rb~
cuba-api-0.4.0 spec/aspects_spec.rb~
cuba-api-0.3.3 spec/config_spec.rb~
cuba-api-0.3.3 spec/aspects_spec.rb~
cuba-api-0.3.2 spec/config_spec.rb~
cuba-api-0.3.2 spec/aspects_spec.rb~
cuba-api-0.3.1 spec/aspects_spec.rb~
cuba-api-0.3.1 spec/config_spec.rb~