Sha256: 55eaac74ac72af4b1be211b5b198f577ddaae3d1edddc6f0f236ed2a25b75ce8

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

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

module OnStomp::Components::Scopes
  describe ReceiptScope do
    let(:client) {
      OnStomp::Client.new("stomp:///")
    }
    let(:receipt_back) {
      lambda { |r| true }
    }
    let(:scope) {
      ReceiptScope.new receipt_back, client
    }
    
    let(:frame_method_interface) { scope }
    it_should_behave_like "frame method interfaces"
    
    describe ".transmit" do
      it "should add its receipt callback to frames transmitted without one" do
        frame = OnStomp::Components::Frame.new('COMMAND', {:header2 => 'my value'})
        client.should_receive(:transmit).with(frame, { :receipt => receipt_back })
        scope.transmit frame
      end
      it "should not add its receipt callback if one was already present" do
        alt_receipt_back = lambda { |r| false }
        frame = OnStomp::Components::Frame.new('COMMAND', {:header2 => 'my value'})
        client.should_receive(:transmit).with(frame, { :receipt => alt_receipt_back })
        scope.transmit frame, :receipt => alt_receipt_back
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
onstomp-1.0.5 spec/onstomp/components/scopes/receipt_scope_spec.rb
onstomp-1.0.4 spec/onstomp/components/scopes/receipt_scope_spec.rb
onstomp-1.0.3 spec/onstomp/components/scopes/receipt_scope_spec.rb
onstomp-1.0.2 spec/onstomp/components/scopes/receipt_scope_spec.rb
onstomp-1.0.1 spec/onstomp/components/scopes/receipt_scope_spec.rb
onstomp-1.0.0 spec/onstomp/components/scopes/receipt_scope_spec.rb
onstomp-1.0.0pre1 spec/onstomp/components/scopes/receipt_scope_spec.rb