Sha256: ef93b217193a8b8e57de1fa3f81ace33045e9c91606363c2cbe65b4bd005b648

Contents?: true

Size: 764 Bytes

Versions: 14

Compression:

Stored size: 764 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.reset!
    Cuba.plugin CubaApi::Config
    Cuba[ :aspects ] = []
    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

  after { Cuba.config.clear }
  
  it 'should execute aspects in the right order' do
     _, _, resp = Cuba.call({})

    resp.join.must.eq "start-two-one-three"
  end
end

Version data entries

14 entries across 12 versions & 1 rubygems

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