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