Sha256: 1926288b40202a66da804b710a7d72600d36016dd8c6c1b99daa2a9a3a81e03a

Contents?: true

Size: 996 Bytes

Versions: 7

Compression:

Stored size: 996 Bytes

Contents

# -*- encoding: utf-8 -*-
require 'spec_helper'

module OnStomp::Components::Scopes
  describe HeaderScope do
    let(:client) {
      OnStomp::Client.new("stomp:///")
    }
    let(:headers) {
      { :header1 => 'value 1', 'header2' => 'value 2'}
    }
    let(:scope) {
      HeaderScope.new headers, client
    }
    
    let(:frame_method_interface) { scope }
    it_should_behave_like "frame method interfaces"

    it "sets up the connection attribute" do
      connection = stub('connection')
      client.should_receive(:connection).and_return(connection)
      scope.connection.should == connection
    end
    
    describe ".transmit" do
      it "should add all its headers to a frame, unless that header name is set" do
        client.stub(:transmit).and_return { |f,_| f }
        frame = scope.transmit OnStomp::Components::Frame.new('COMMAND', {:header2 => 'my value'})
        frame.should have_headers(:header1 => 'value 1', :header2 => 'my value')
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
onstomp-1.0.12 spec/onstomp/components/scopes/header_scope_spec.rb
onstomp-1.0.11 spec/onstomp/components/scopes/header_scope_spec.rb
onstomp-1.0.10 spec/onstomp/components/scopes/header_scope_spec.rb
onstomp-1.0.9 spec/onstomp/components/scopes/header_scope_spec.rb
onstomp-1.0.8 spec/onstomp/components/scopes/header_scope_spec.rb
onstomp-1.0.7 spec/onstomp/components/scopes/header_scope_spec.rb
onstomp-1.0.6 spec/onstomp/components/scopes/header_scope_spec.rb