Sha256: 4f9082b5dd87cc7cc9ac737ce4f73db108cf5f32e5a73a21f18723562d95b573

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper.rb'

describe RocketAMF::Values::AbstractMessage do
  before :each do
    @message = RocketAMF::Values::AbstractMessage.new
  end

  it "should generate conforming uuids" do
    @message.send(:rand_uuid).should =~ /[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}/i
  end
end

describe RocketAMF::Values::ErrorMessage do
  before :each do
    @e = Exception.new('Error message')
    @e.set_backtrace(['Backtrace 1', 'Backtrace 2'])
    @message = RocketAMF::Values::ErrorMessage.new(nil, @e)
  end

  it "should serialize as a hash in AMF0" do
    response = RocketAMF::Response.new
    response.messages << RocketAMF::Message.new('1/onStatus', '', @message)
    response.serialize.should == request_fixture('amf0-error-response.bin')
  end

  it "should extract exception properties correctly" do
    @message.faultCode.should == 'Exception'
    @message.faultString.should == 'Error message'
    @message.faultDetail.should == "Backtrace 1\nBacktrace 2"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
RocketAMF-0.1.0 spec/amf/values/messages_spec.rb
RocketAMF-0.0.7 spec/amf/values/messages_spec.rb
RocketAMF-0.0.6 spec/amf/values/messages_spec.rb
RocketAMF-0.0.5 spec/amf/values/messages_spec.rb