Sha256: 66e211e58c28e48f21e0c9efe879c0eaf96e2ce53247b6945f2c9358bee81c4d

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Valvat::Lookup::Response do
  it 'removes @xmlns from :check_vat_response hash' do
    expect(described_class.new({
                                 check_vat_response: { :a => 1, :b => 2, :@xmlns => true }
                               }).to_hash).to eql({ a: 1, b: 2 })
  end

  it "removes 'trader_'-Prefixes :check_vat_response hash" do
    expect(described_class.new({
                                 check_vat_response: { a: 1, trader_b: 2 }
                               }).to_hash).to eql({ a: 1, b: 2 })
  end

  it 'accepts hash keyed as :check_vat_approx_response' do
    expect(described_class.new({
                                 check_vat_approx_response: { a: 1, b: 2 }
                               }).to_hash).to eql({ a: 1, b: 2 })
  end

  it 'allows direct access to hash via []' do
    expect(described_class.new({
                                 check_vat_response: { a: 123, b: 2 }
                               })[:a]).to be(123)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
valvat-1.1.5 spec/valvat/lookup/response_spec.rb
valvat-1.1.4 spec/valvat/lookup/response_spec.rb
valvat-1.1.3 spec/valvat/lookup/response_spec.rb
valvat-1.1.2 spec/valvat/lookup/response_spec.rb
valvat-1.1.1 spec/valvat/lookup/response_spec.rb
valvat-1.1.0 spec/valvat/lookup/response_spec.rb