Sha256: 1e5ba41a5c64e6b65b0a405f582fee06a1da4b39b76dd5f8b576c3324ce116a6

Contents?: true

Size: 1.7 KB

Versions: 2

Compression:

Stored size: 1.7 KB

Contents

Given /^a header scope with headers$/ do |table|
  headers = table_to_headers table
  @scope = @connection.with_headers(headers)
end

When /^the client acks a message by ID "([^"]*)" and subscription "([^"]*)" within the scope$/ do |message_id, subscription|
  @scope.ack message_id, subscription
end

When /^the client subscribes to "([^"]*)" with headers within the scope$/ do |dest, table|
  @subscribe_frames ||= []
  headers = table_to_headers table
  @default_subscription_triggered = 0
  @subscribe_frames << @scope.subscribe(dest, headers) do |m|
    @default_subscription_triggered += 1
  end
end

Given /^a transaction scope named "([^"]*)"$/ do |tx|
  @scope = @connection.with_transaction(:transaction => tx)
end

When /^the client begins the transaction scope$/ do
  @scope.begin
end

When /^the client nacks a message by ID "([^"]*)" and subscription "([^"]*)" within the scope$/ do |message_id, subscription|
  @scope.nack message_id, subscription
end

When /^the client aborts the transaction scope$/ do
  @scope.abort
end

When /^the client executes a successful transaction block named "([^"]*)"$/ do |tx|
  @connection.with_transaction(:transaction => tx) do |t|
    t.ack "message-id", "subscription-id"
    t.send "/queue/transaction/test", "message"
    t.nack "message-id-2", "subscription-id-2"
  end
end

When /^the client executes an unsuccessful transaction block named "([^"]*)"$/ do |tx|
  lambda do
    @connection.with_transaction(:transaction => tx) do |t|
      t.ack "message-id", "subscription-id"
      t.send "/queue/transaction/test", "message"
      t.nack "message-id-2", "subscription-id-2"
      raise "transaction will now fail"
    end
  end.should raise_error("transaction will now fail")
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stomper-2.0.1 features/steps/scopes_steps.rb
stomper-2.0.0 features/steps/scopes_steps.rb