Sha256: 66ce00d851b6bc2edde46a7f096faf3a9dcf8acfc4af68d000247cddd841ba45

Contents?: true

Size: 1.38 KB

Versions: 6

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

# Helpers method for admin requester
# Use this methods before execute block 'it'

# Prepare variable for sending request to RabbitMQ
def help_admin_prepare
  @opt_instance = instance
  @opt_transaction = {}
  @transaction = nil
end

# Create a session
def help_admin_create_session
  @gateway.session_endpoint_public(@opt_instance) do |transaction|
    session = transaction.publish_message('base::create', @opt_transaction).session

    @opt_transaction['session_id'] = session
    @opt_instance.merge!(@opt_transaction)
  end
end

# Create a handler (attached to plugin echo test)
def help_admin_create_handler
  @gateway.session_endpoint_public(@opt_instance) do |transaction|
    handler = transaction.publish_message('base::attach', @opt_transaction).sender
    @opt_transaction['handle_id'] = handler
    @opt_instance.merge!(@opt_transaction)
  end
end

# Execute an action before test requester result
def help_admin_request_before(type_before, admin_opt = {})
  @opt_transaction.merge!(admin_opt)

  @gateway.admin_endpoint(@opt_instance) do |transaction|
    transaction.publish_message(type_before, @opt_transaction)
  end
end

# Request tested
def help_admin_request_tested(admin_opt = {})
  @opt_transaction.merge!(admin_opt)

  @gateway.admin_endpoint(@opt_instance) do |transaction|
    @transaction = transaction.publish_message(type, @opt_transaction)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-3.0.0.pre.336 spec/support/admin_requester.rb
ruby_rabbitmq_janus-3.0.0.pre.335 spec/support/admin_requester.rb
ruby_rabbitmq_janus-3.0.0.pre.334 spec/support/admin_requester.rb
ruby_rabbitmq_janus-3.0.0.pre.330 spec/support/admin_requester.rb
ruby_rabbitmq_janus-3.0.0.pre.328 spec/support/admin_requester.rb
ruby_rabbitmq_janus-3.0.0.pre.327 spec/support/admin_requester.rb