Sha256: b70c530fb8f6a2ee5971e49f2a539b9ee60241d7cee919671667542069971a8a

Contents?: true

Size: 1.26 KB

Versions: 38

Compression:

Stored size: 1.26 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.'
      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

38 entries across 38 versions & 1 rubygems

Version Path
polish_cell_number_checker-0.0.45 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.44 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.43 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.42 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.41 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.40 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.39 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.38 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.37 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.36 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.35 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.34 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.33 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.32 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.31 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.30 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.29 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.27 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.26 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.25 spec/polish_cell_number_checker_spec.rb