Sha256: 95eb355660bafd91b077fc215d1e92c549b2576e9120b1e7053dc3192c738c46

Contents?: true

Size: 974 Bytes

Versions: 1

Compression:

Stored size: 974 Bytes

Contents

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

module Stomper
  describe FrameWriter do
    before(:each) do
      @output_buffer = StringIO.new("", "w+")
      @output_buffer.send(:extend, Stomper::FrameWriter)
    end

    it "should write commands appropriately" do
      @output_buffer.transmit_frame(Stomper::Frames::Send.new('/test/queue','body of message'))
      @output_buffer.string.should =~ /\ASEND/
    end

    it "should write headers appropriately" do
      @output_buffer.transmit_frame(Stomper::Frames::Send.new('/test/queue','body of message', :a_header => "3", :another => 23))
      split_str = @output_buffer.string.split("\n")
      split_str.shift
      headers = ['a_header:3', 'another:23', 'content-length:15', 'destination:/test/queue']
      until (header_line = split_str.shift).empty?
        headers.should include(header_line)
        headers.delete(header_line)
      end
      headers.should be_empty
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stomper-1.0.0 spec/frame_writer_spec.rb