Sha256: c3fa04c3e8d4cfb842406f5d93956deddfb822d137c6a3529e8a927b49e7a4a2

Contents?: true

Size: 1.74 KB

Versions: 51

Compression:

Stored size: 1.74 KB

Contents

# frozen_string_literal: true

shared_examples 'test convert type' do |klass|
  let(:option) { { key => value } }
  let(:value_test) { defined?(value_return) ? value_return : value }

  it { expect(converter.convert(key, option)).to be_kind_of(klass) }
  it { expect(converter.convert(key, option)).to eql(value_test) }
end

shared_examples 'match convert type' do |klass, size|
  it { expect(converter.convert(key)).to be_kind_of(klass) }
  it { expect(converter.convert(key)).to match(value) }
  it { expect(converter.convert(key).length).to eql(size) }
end

shared_examples 'test convert type array' do |klass|
  include_examples 'test convert type', klass

  it { expect(value.count).to eql(size) }
end

shared_examples 'test convert type hash' do |klass|
  include_examples 'test convert type', klass

  it { expect(value_test[1]).to be_kind_of(Hash) }
  it { expect(value_test[1]).to eql(value_hash) }
end

shared_examples 'test replace in request' do |element, type|
  let(:transform) { replace.transform_request }
  let(:value) { defined?(value_return) ? value_return : element }

  include_examples 'with keys', element

  it { expect(keys).to be_kind_of(type) }
  it { expect(keys).to eql(options[value]) }
end

shared_examples 'test replace in request nil' do |element|
  let(:transform) { replace.transform_request }

  include_examples 'with keys', element

  it 'option should equal nil' do
    expect(options[element]).to be(nil)
  end

  it 'result be a kind of String' do
    expect(keys).to be_kind_of(String)
  end

  it 'result should not equal to nil' do
    expect(keys).not_to be_nil
  end
end

shared_context 'with keys' do |element|
  let(:keys) do
    if defined?(key)
      transform[key][element]
    else
      transform[element]
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-3.0.0.pre.336 spec/support/type.rb
ruby_rabbitmq_janus-3.0.0.pre.335 spec/support/type.rb
ruby_rabbitmq_janus-3.0.0.pre.334 spec/support/type.rb
ruby_rabbitmq_janus-3.0.0.pre.330 spec/support/type.rb
ruby_rabbitmq_janus-3.0.0.pre.328 spec/support/type.rb
ruby_rabbitmq_janus-3.0.0.pre.327 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.322 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.320 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.319 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.318 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.317 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.316 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.315 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.314 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.312 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.310 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.309 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.308 spec/support/type.rb
ruby_rabbitmq_janus-2.7.2.pre.307 spec/support/type.rb