Sha256: 84ddfcb196b836401bacee689ac120407745563065ba00d3ee8bb0d2ad1f35ee

Contents?: true

Size: 819 Bytes

Versions: 12

Compression:

Stored size: 819 Bytes

Contents

require 'spec_helper'
require 'cuba_api/response_status'

class E
  def initialize( args = nil )
    @errors = args.delete( :errors ) || {}
    @attributes = args
  end
    
  def deleted?
    @attrbutes.nil?
  end

  def errrors
    @errors
  end
end


describe CubaApi::ResponseStatus do

  before do
    Cuba.reset!
    Cuba.plugin CubaApi::ResponseStatus
    Cuba.plugin CubaApi::WriteAspect
    Cuba.define do
      on get do
        write E.new :errors => { :name => 'missing name' }
      end
      on post do
        write E.new :message => 'be happy' 
      end
      on put do
        write E.new :message => 'be happy' 
      end
      on delete do
        write E.new
      end
    end
  end

  it 'status 200' do
     _, _, resp = Cuba.call({'REQUEST_METHOD' => 'GET'})
    resp.join.must.eq ""
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

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