norwegian_phone 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ pkg/*
4
4
  .rvmrc
5
5
  .rspec
6
6
  Gemfile.lock
7
+ coverage
@@ -17,14 +17,13 @@ Lacking complete knowledge of the phone system this is based on common sense and
17
17
  == Usage
18
18
 
19
19
  gem install no_phone
20
-
21
-
22
20
  require 'no_phone'
23
21
 
24
- class SomethingSpecial
25
- extend NorwegianPhone
26
- end
27
-
28
- SomethingSpecial.normalize "0047 (123) 45-678"
22
+ NorwegianPhone.normalize "0047 (123) 45-678"
29
23
  => "12345678"
30
24
 
25
+ NorwegianPhone.number_valid?("0047 (123) 45-678")
26
+ => true
27
+
28
+ NorwegianPhone.international?("0047 (123) 45-678")
29
+ => false
data/Rakefile CHANGED
@@ -1,2 +1,11 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
+
4
+ namespace :ci do
5
+ desc "setup for continuous integration"
6
+ task :prepare do
7
+ # nothing to do here
8
+ # the task is necessary for our CI environment
9
+ end
10
+ end
11
+
@@ -8,7 +8,6 @@ module NorwegianPhone
8
8
  number.gsub!(/^00/, '+')
9
9
  number.gsub!(/^\+47/, '')
10
10
  number.gsub!(/^\+*0+/, '+')
11
- number.gsub!(/^47/, '') if number.size > 8
12
11
  number
13
12
  end
14
13
 
@@ -1,3 +1,3 @@
1
1
  module NorwegianPhone
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -14,7 +14,11 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "norwegian_phone"
16
16
 
17
+ s.add_development_dependency('rake')
17
18
  s.add_development_dependency('rspec')
19
+ s.add_development_dependency('rspec-extra-formatters')
20
+ s.add_development_dependency('simplecov')
21
+ s.add_development_dependency('simplecov-rcov')
18
22
 
19
23
  s.files = `git ls-files`.split("\n")
20
24
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -5,10 +5,6 @@ describe NorwegianPhone, "#normalize" do
5
5
  let(:number) { "12345678" }
6
6
 
7
7
  context "with country code" do
8
- it "deletes prepended country code (47)" do
9
- NorwegianPhone.normalize("4712345678").should == number
10
- end
11
-
12
8
  it "deletes prepended 0047" do
13
9
  NorwegianPhone.normalize("004712345678").should == number
14
10
  end
@@ -31,6 +27,10 @@ describe NorwegianPhone, "#normalize" do
31
27
  end
32
28
 
33
29
  context "without country code" do
30
+ it "does not delete prepended country code (47)" do
31
+ NorwegianPhone.normalize("4712345678").should == '4712345678'
32
+ end
33
+
34
34
  it "leaves extra digits intact" do
35
35
  NorwegianPhone.normalize("123456789").should == "#{number}9"
36
36
  end
@@ -1,4 +1,15 @@
1
- require 'rubygems'
1
+ require 'simplecov'
2
+ require 'simplecov-rcov'
3
+ require 'rspec-extra-formatters'
4
+
2
5
  require 'bundler/setup'
6
+ class SimpleCov::Formatter::MergedFormatter
7
+ def format(result)
8
+ SimpleCov::Formatter::HTMLFormatter.new.format(result)
9
+ SimpleCov::Formatter::RcovFormatter.new.format(result)
10
+ end
11
+ end
12
+ SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
13
+ SimpleCov.start
3
14
 
4
15
  require 'norwegian_phone'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norwegian_phone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,27 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-28 00:00:00.000000000Z
12
+ date: 2012-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
14
30
  - !ruby/object:Gem::Dependency
15
31
  name: rspec
16
- requirement: &70097449596920 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
17
33
  none: false
18
34
  requirements:
19
35
  - - ! '>='
@@ -21,7 +37,60 @@ dependencies:
21
37
  version: '0'
22
38
  type: :development
23
39
  prerelease: false
24
- version_requirements: *70097449596920
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec-extra-formatters
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: simplecov
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov-rcov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
25
94
  description: Standardizes norwegian phone numbers, and leaves international numbers
26
95
  unchanged.
27
96
  email:
@@ -62,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
131
  version: '0'
63
132
  requirements: []
64
133
  rubyforge_project: norwegian_phone
65
- rubygems_version: 1.8.6
134
+ rubygems_version: 1.8.22
66
135
  signing_key:
67
136
  specification_version: 3
68
137
  summary: Norwegian phone number scrubber