Sha256: f4dc7e82474bd8c04776c214c1470c929791fb1336f4f2f65e903555230927f2

Contents?: true

Size: 1.71 KB

Versions: 8

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:          "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:          "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:          "United Kingdom")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
picturehouse_uk-3.0.14 test/lib/picturehouse_uk/internal/parser/address_parser_test.rb
picturehouse_uk-3.0.13 test/lib/picturehouse_uk/internal/parser/address_parser_test.rb
picturehouse_uk-3.0.12 test/lib/picturehouse_uk/internal/parser/address_parser_test.rb
picturehouse_uk-3.0.11 test/lib/picturehouse_uk/internal/parser/address_parser_test.rb
picturehouse_uk-3.0.10 test/lib/picturehouse_uk/internal/parser/address_parser_test.rb
picturehouse_uk-3.0.9 test/lib/picturehouse_uk/internal/parser/address_parser_test.rb
picturehouse_uk-3.0.8 test/lib/picturehouse_uk/internal/parser/address_parser_test.rb
picturehouse_uk-3.0.7 test/lib/picturehouse_uk/internal/parser/address_parser_test.rb