dialy 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,8 +16,16 @@ describe "Dialy" do
16
16
  Dialy::AREA_CODES['41'].should be_include('44')
17
17
  end
18
18
 
19
+ describe "options" do
20
+ it "should use default_country_code" do
21
+ Dialy::Config[:default_country_code] = '41'
22
+ Dialy.format_number('030-12345678').should == '+41 30 12345678'
23
+ end
24
+ end
25
+
19
26
  describe "Germany" do
20
27
  before :each do
28
+ Dialy::Config[:default_country_code] = '49'
21
29
  @expected = '+49 2406 12345678'
22
30
  end
23
31
 
@@ -43,19 +51,21 @@ describe "Dialy" do
43
51
  end
44
52
 
45
53
  describe "German mobile" do
54
+ before :each do
55
+ Dialy::Config[:default_country_code] = '49'
56
+ end
57
+
46
58
  it "should format" do
47
59
  Dialy.format_number('0163-1234567').should == '+49 163 1234567'
48
60
  Dialy.format_number('0171-1234567').should == '+49 171 1234567'
49
61
  end
50
62
  end
51
63
 
52
- describe "Switzerland" do
53
- it "should format" do
54
- Dialy.format_number('0041-71-123 45 67').should == '+41 71 1234567'
64
+ describe "obsure input" do
65
+ before :each do
66
+ Dialy::Config[:default_country_code] = '49'
55
67
  end
56
- end
57
-
58
- describe "other" do
68
+
59
69
  it "should format" do
60
70
  Dialy.format_number('(+49) (08541) 123456').should == '+49 8541 123456'
61
71
  Dialy.format_number('0 08 00-1 23 45 67').should == '+800 1234567'
@@ -63,6 +73,17 @@ describe "Dialy" do
63
73
  end
64
74
  end
65
75
 
76
+ describe "Switzerland" do
77
+ before :each do
78
+ Dialy::Config[:default_country_code] = '41'
79
+ end
80
+
81
+ it "should format" do
82
+ Dialy.format_number('0041-71-123 45 67').should == '+41 71 1234567'
83
+ Dialy.format_number('71-123 45 67').should == '+41 71 1234567'
84
+ end
85
+ end
86
+
66
87
  describe "Wrong formatting" do
67
88
  it "should fail with +" do
68
89
  lambda { Dialy.format_number('++49') }.should raise_error(ArgumentError)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dialy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 3
10
- version: 0.0.3
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Georg Ledermann
@@ -52,6 +52,9 @@ files:
52
52
  - VERSION
53
53
  - dialy.gemspec
54
54
  - lib/dialy.rb
55
+ - lib/dialy/config.rb
56
+ - lib/dialy/data.rb
57
+ - lib/dialy/formatter.rb
55
58
  - spec/dialy_spec.rb
56
59
  - spec/spec.opts
57
60
  - spec/spec_helper.rb