Sha256: 05b3e57e1c5c4b04594bfe759b94f68d9c0a9d5a10425a6e90f43fb8dc61e418

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Roqua::Healthy::A19::PhoneValidator do
  subject { described_class }

  describe '#phone_cell_number?' do
    it 'detects a Dutch mobile number' do
      expect(subject.phone_cell_number?('+31612345678')).to be_truthy
    end

    it 'rejects a phone number that consists of something other than numbers' do
      expect(subject.phone_cell_number?('0612345678mdr')).to be_falsey
    end

    it 'detects a Dutch mobile number without a country code' do
      expect(subject.phone_cell_number?('0612345678')).to be_truthy
    end

    it 'rejects a normal Dutch phone number' do
      expect(subject.phone_cell_number?('+31592123456')).to be_falsey
    end

    it 'detects a mobile number from Austria' do
      expect(subject.phone_cell_number?('+4365012345678')).to be_truthy
    end

    it 'rejects a normal phone number from Austria' do
      expect(subject.phone_cell_number?('+431123456')).to be_falsey
    end

    it 'rejects a mobile number from China' do
      expect(subject.phone_cell_number?('+8613312345678')).to be_falsey
    end

    it 'rejects a normal phone number from China' do
      expect(subject.phone_cell_number?('+86312123456')).to be_falsey
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
roqua-healthy-1.6.0 spec/unit/a19/phone_validator_spec.rb
roqua-healthy-1.5.13 spec/unit/a19/phone_validator_spec.rb
roqua-healthy-1.5.12 spec/unit/a19/phone_validator_spec.rb
roqua-healthy-1.5.11 spec/unit/a19/phone_validator_spec.rb
roqua-healthy-1.5.10 spec/unit/a19/phone_validator_spec.rb
roqua-healthy-1.5.9 spec/unit/a19/phone_validator_spec.rb
roqua-healthy-1.5.8 spec/unit/a19/phone_validator_spec.rb
roqua-healthy-1.5.7 spec/unit/a19/phone_validator_spec.rb
roqua-healthy-1.5.6 spec/unit/a19/phone_validator_spec.rb
roqua-healthy-1.5.5 spec/unit/a19/phone_validator_spec.rb