Sha256: 868c30cb419903a214813734c5b68d47f364e07bc75d9fab59c064f963103241

Contents?: true

Size: 754 Bytes

Versions: 12

Compression:

Stored size: 754 Bytes

Contents

require 'spec_helper'
require 'cuba_api/write_aspect'
require 'cuba_api/serializer'
require 'yaml'
require 'ixtlan/babel/serializer'

class A
  def attributes
    { :name => 'me and the corner' }
  end
end
class ASerializer < Ixtlan::Babel::Serializer
end
module ToYaml
  def to_yaml( obj, opts )
    obj.to_yaml
  end
end

describe CubaApi::Serializer do

  before do
    Cuba.reset!
    Cuba[ :aspects ] = []
    Cuba.plugin CubaApi::WriteAspect
    Cuba.plugin CubaApi::Serializer
    Cuba.plugin ToYaml
    Cuba.append_aspect :to_yaml
    Cuba.define do
      on default do
        write A.new
      end
    end
  end

  it 'should write out yaml' do
     _, _, resp = Cuba.call({})
    
    resp.must.eq ["---\nname: me and the corner\n"]
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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