Sha256: 075feae4e9aee9462dbd64b77481bc1d7575cbf4c5150c5fa9eaebd1d6807d34

Contents?: true

Size: 898 Bytes

Versions: 4

Compression:

Stored size: 898 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.configure do |config|
      config.default_country_code = nil
      config.default_area_code = nil
    end
  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

4 entries across 4 versions & 1 rubygems

Version Path
phonie-3.1.2 test/test_helper.rb
phonie-3.1.1 test/test_helper.rb
phonie-3.1.0 test/test_helper.rb
phonie-3.0.0 test/test_helper.rb