Sha256: 271f7320a90cdd1f1f1a6ed12fa1e344feecefcd0f48ea30bdf63aa31e4c4391

Contents?: true

Size: 1.28 KB

Versions: 11

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe PolishCellNumber::Checker do
  describe ".cell_number?" do
    context "when passing number is cell number" do
      it "return true" do
        expect(PolishCellNumber::Checker.new('+48 608-111-111').cell_number?).to be_truthy
      end
    end

    context "when passing number is not cell number" do
      it "return false" do
        expect(PolishCellNumber::Checker.new('+48 751-11-111').cell_number?).to be_falsey
      end
    end

    context "when passing number is not valid number" do
      it "return false" do
        expect(PolishCellNumber::Checker.new('+48 751-11').cell_number?).to be_falsey
      end
    end
  end

  describe ".operator_name" do
    context "when passing number is cell number" do
      it "return operator name" do
        expect(PolishCellNumber::Checker.new('+48 608-111-111').operator_name).to eq 'T-MOBILE POLSKA S.A. (d. PTC S.A.)'
      end
    end

    context "when passing number is not cell number" do
      it "return nil" do
        expect(PolishCellNumber::Checker.new('+48 751-11-111').operator_name).to be_nil
      end
    end

    context "when passing number is not valid number" do
      it "return nil" do
        expect(PolishCellNumber::Checker.new('+48 751-11').operator_name).to be_nil
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
polish_cell_number_checker-0.0.56 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.55 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.54 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.53 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.52 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.51 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.50 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.49 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.48 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.47 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.46 spec/polish_cell_number_checker_spec.rb