Sha256: 85f1de05fef1dfcf11f5c3220c99d6aebfc0c9a8b231abb74d916e22ee34d66b
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe Valvat::Lookup::HMRC do before do stub_const('Valvat::Lookup::HMRC::ENDPOINT_URL', 'https://test-api.service.hmrc.gov.uk/organisations/vat/check-vat-number/lookup') end it 'returns hash with valid: true on success' do response = described_class.new('GB553557881', { uk: true }).perform expect(response).to match({ valid: true, address: "131B Barton Hamlet\nSW97 5CK\nGB", country_code: 'GB', vat_number: '553557881', name: 'Credite Sberger Donal Inc.', request_date: kind_of(Time) }) end it 'returns hash with valid: false on invalid input' do response = described_class.new('GB123456789', { uk: true }).perform expect(response).to match({ valid: false }) end it 'returns hash with valid: false on valid input with :uk option not set' do response = described_class.new('GB553557881', {}).perform expect(response).to match({ valid: false }) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
valvat-1.3.0 | spec/valvat/lookup/hmrc_spec.rb |
valvat-1.2.1 | spec/valvat/lookup/hmrc_spec.rb |
valvat-1.2.0 | spec/valvat/lookup/hmrc_spec.rb |