Sha256: 443a35b46066366b6fe3ca5426d282d550c970bb8d062bbbc0b56e03a8faa18a

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

require_relative '../../../../test_helper'

describe PicturehouseUk::Internal::Parser::Address do
  let(:described_class) { PicturehouseUk::Internal::Parser::Address }

  describe '#address' do
    subject { described_class.new(html).address }

    # real functionality tested via integration

    describe 'passed nil' do
      let(:html) { nil }

      it 'returns hash of nils' do
        subject.must_be_instance_of(Hash)
        subject.must_equal(street_address:   nil,
                           extended_address: nil,
                           locality:         nil,
                           region:           nil,
                           postal_code:      nil,
                           country_name:     "United Kingdom")
      end
    end

    describe 'passed empty string' do
      let(:html) { '' }

      it 'returns hash of nils' do
        subject.must_be_instance_of(Hash)
        subject.must_equal(street_address:   nil,
                           extended_address: nil,
                           locality:         nil,
                           region:           nil,
                           postal_code:      nil,
                           country_name:     "United Kingdom")
      end
    end

    describe 'passed nonsense' do
      let(:html) { 'not an address' }

      it 'returns hash of nils' do
        subject.must_be_instance_of(Hash)
        subject.must_equal(street_address:   nil,
                           extended_address: nil,
                           locality:         "not an address",
                           region:           nil,
                           postal_code:      "not an address",
                           country_name:     "United Kingdom")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picturehouse_uk-4.0.0 test/lib/picturehouse_uk/internal/parser/address_test.rb