Sha256: 42df33927cb93c10fbecc1336a3462bf9c1c93840b831a3ef4c45a777b10f9bd

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 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
        PolishCellNumber::Checker.new('+48 608-111-111').cell_number?.should be_true
      end
    end

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

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

  describe ".operator_name" do
    context "when passing number is cell number" do
      it "return operator name" do
        PolishCellNumber::Checker.new('+48 608-111-111').operator_name.should eql 'PTC S.A.'
      end
    end

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
polish_cell_number_checker-0.0.6 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.5 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.4 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.3 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.2 spec/polish_cell_number_checker_spec.rb
polish_cell_number_checker-0.0.1 spec/polish_cell_number_checker_spec.rb