Sha256: 0004dc03f1470fbe6eb30d3b986fbc65cdc68ae1c77a36b8a3ac1c35a27ec381

Contents?: true

Size: 867 Bytes

Versions: 9

Compression:

Stored size: 867 Bytes

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')

require 'rubygems'

require 'test/unit'
require 'phonie'

def parse_test(raw, country_code, area_code, number, country_name = nil, is_mobile = nil)
  pn = Phonie::Phone.parse!(raw)
  assert_equal pn.country_code, country_code
  assert_equal pn.area_code, area_code
  assert_equal pn.number, number
  if country_name
    assert_equal pn.country.name, country_name
  end

  unless is_mobile.nil?
    assert_equal is_mobile, pn.is_mobile?
  end
end


class Phonie::TestCase < Test::Unit::TestCase

  def setup
    Phonie::Phone.default_country_code = nil
    Phonie::Phone.default_area_code = nil
  end

  def default_test
    klass = self.class.to_s
    ancestors = (self.class.ancestors - [self.class]).collect { |ancestor| ancestor.to_s }
    super unless klass =~ /TestCase/ or ancestors.first =~ /TestCase/
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
phonie-2.1.2 test/test_helper.rb
phonie-2.1.1 test/test_helper.rb
phonie-2.1.0 test/test_helper.rb
phonie-2.0.2 test/test_helper.rb
phonie-2.0.1 test/test_helper.rb
phonie-2.0.0 test/test_helper.rb
phonie-1.0.4 test/test_helper.rb
phonie-1.0.3 test/test_helper.rb
phonie-1.0.2 test/test_helper.rb