Sha256: c738958035e8489e64f319634386410e8c79e4a7fb275963ba0ccead0bb670d4

Contents?: true

Size: 1.62 KB

Versions: 45

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

shared_examples 'empty response' do
  it 'matches JSON empty' do
    message
    expect(@response.to_json).to eq('{}')
  end
end

shared_examples 'schema response' do
  it do
    message
    expect(@response.to_json).to match_json_schema(@type)
  end
end

shared_examples 'transaction should match json empty' do
  let(:message) do
    @gateway.start_transaction(false, @session_instance) do |transaction|
      @response = transaction.publish_message(@type, @options)
    end
  end

  include_examples 'empty response'
end

shared_examples 'transaction should match json schema' do
  let(:message) do
    @gateway.start_transaction(true, @session_instance) do |transaction|
      @response = transaction.publish_message(@type, @options)
    end
  end

  include_examples 'schema response'
end

shared_examples 'transaction handle should match json schema' do
  let(:message) do
    @gateway.start_transaction_handle(true, @session_instance) do |transaction|
      @response = transaction.publish_message(@type, @options)
    end
  end

  include_examples 'schema response'
end

shared_examples 'transaction handle should match json empty' do
  let(:message) do
    @gateway.start_transaction_handle(false, @session_instance) do |transaction|
      @response = transaction.publish_message(@type, @options)
    end
  end

  include_examples 'empty response'
end

shared_examples 'transaction admin should match json schema' do
  let(:message) do
    @gateway.start_transaction_admin(@instance) do |transaction|
      @response = transaction.publish_message(@type, @options)
    end
  end

  include_examples 'schema response'
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-2.7.2 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.322 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.320 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.319 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.318 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.317 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.316 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.315 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.314 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.312 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.310 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.309 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.308 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.307 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.306 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.305 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.302 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.297 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.296 spec/support/examples_request.rb
ruby_rabbitmq_janus-2.7.2.pre.286 spec/support/examples_request.rb