Sha256: 49688ce37271278b353543d7f69f58688df9d2aa987f9bfc29d694e008a95eff

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8
require 'spec_helper'
require 'integration/coolio/spec_helper'

describe "AMQ::Client::Coolio", "Tx.Commit", :nojruby => true do
  include EventedSpec::SpecHelper
  default_timeout 2
  let(:message) { "Hello, world!" }


  #
  # Examples
  #

  it "should confirm transaction completeness" do
    received_messages = []
    coolio_amqp_connect do |client|
      channel = AMQ::Client::Channel.new(client, 1)
      channel.open do
        exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
        queue = AMQ::Client::Queue.new(client, channel)

        queue.declare(false, false, false, true) do
          queue.bind(exchange)
        end

        channel.tx_select do
          queue.consume(true) do |header, payload, delivery_tag, redelivered, exchange, routing_key, message_count|
            received_messages << message
            done
          end

          exchange.publish(message)
          channel.tx_commit
        end
      end
    end
    received_messages.should == [message]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
amq-client-0.7.0.alpha3 spec/integration/coolio/tx_commit_spec.rb
amq-client-0.7.0.alpha2 spec/integration/coolio/tx_commit_spec.rb
amq-client-0.7.0.alpha1 spec/integration/coolio/tx_commit_spec.rb
amq-client-0.5.0 spec/integration/coolio/tx_commit_spec.rb