decoder 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ class CommonMethodsTest < Test::Unit::TestCase
6
6
  include CommonMethods
7
7
  attr_accessor :code, :name
8
8
  end
9
-
9
+
10
10
  context "CommonMethods" do
11
11
  setup do
12
12
  @empty_class = EmptyClass.new
@@ -16,7 +16,7 @@ class CommonMethodsTest < Test::Unit::TestCase
16
16
  should "print #name for #to_s" do
17
17
  assert_equal @empty_class.name, @empty_class.to_s
18
18
  end
19
-
19
+
20
20
  should "print '#<#class code: code, #name: #name>" do
21
21
  assert_equal "#<CommonMethodsTest::EmptyClass code: TS, name: TEST>", @empty_class.inspect
22
22
  end
@@ -9,7 +9,7 @@ class CountriesTest < Test::Unit::TestCase
9
9
  setup do
10
10
  Decoder.i18n = :en
11
11
  end
12
-
12
+
13
13
  context "a new object" do
14
14
  should "load the yaml" do
15
15
  Decoder.expects(:load_yaml).returns({:en => {"US" => {:name => "United States", :states => {"MA" => "Massachusetts"}}}})
@@ -17,12 +17,12 @@ class CountriesTest < Test::Unit::TestCase
17
17
  assert_not_nil countries.countries
18
18
  end
19
19
  end
20
-
20
+
21
21
  context "Getting a country" do
22
22
  setup do
23
23
  @countries = Decoder::Countries.new
24
24
  end
25
-
25
+
26
26
  should "return a country object of \"United States\" for :US" do
27
27
  country = @countries[:US]
28
28
  assert_equal Decoder::Country, country.class
@@ -48,7 +48,7 @@ class CountriesTest < Test::Unit::TestCase
48
48
  end
49
49
 
50
50
  end
51
-
51
+
52
52
  context "Getting a country alternate form" do
53
53
 
54
54
  should "return a country object of \"United States\" for :US" do
@@ -78,5 +78,5 @@ class CountriesTest < Test::Unit::TestCase
78
78
  end
79
79
 
80
80
  end
81
-
81
+
82
82
  end
@@ -10,7 +10,7 @@ class CountryTest < Test::Unit::TestCase
10
10
  setup do
11
11
  Decoder.i18n = :en
12
12
  end
13
-
13
+
14
14
  context "A new country" do
15
15
  should "load the yaml" do
16
16
  Decoder.expects(:load_yaml).returns({:en => {"US" => {:name => "United States", :states => {"MA" => "Massachusetts"}}}})
@@ -19,17 +19,17 @@ class CountryTest < Test::Unit::TestCase
19
19
  assert_not_nil country.states
20
20
  end
21
21
  end
22
-
22
+
23
23
  context "Getting a state" do
24
24
  setup do
25
25
  @country = Decoder::Country.new(:code => "US", :name => "United States")
26
26
  end
27
-
27
+
28
28
  should "return a state object of \"Massachusetts\" for :MA" do
29
29
  state = @country[:MA]
30
30
  assert_equal Decoder::State, state.class
31
31
  end
32
-
32
+
33
33
  should "return a state object of \"Massachusetts\" for :ma" do
34
34
  state = @country[:ma]
35
35
  assert_equal Decoder::State, state.class
@@ -46,31 +46,31 @@ class CountryTest < Test::Unit::TestCase
46
46
  end
47
47
 
48
48
  end
49
-
49
+
50
50
  context "#states" do
51
51
  setup do
52
52
  @country = Decoder::Country.new(:code => "US", :name => "United States")
53
53
  end
54
-
54
+
55
55
  should "a hash of states" do
56
56
  assert_equal "Massachusetts", @country.states["MA"]
57
57
  end
58
-
58
+
59
59
  context "aliases" do
60
60
  should "be equal for #states and #counties" do
61
61
  assert_equal @country.states, @country.counties
62
- end
63
-
62
+ end
63
+
64
64
  should "be equal for #states and #provinces" do
65
65
  assert_equal @country.states, @country.provinces
66
66
  end
67
-
67
+
68
68
  should "be equal for #states and #territories" do
69
69
  assert_equal @country.states, @country.territories
70
70
  end
71
71
  end
72
72
  end
73
-
73
+
74
74
  end
75
-
75
+
76
76
  end
data/test/decoder_test.rb CHANGED
@@ -5,19 +5,19 @@ class DecoderTest < Test::Unit::TestCase
5
5
  should "default to :eng" do
6
6
  assert_equal :en, Decoder.i18n
7
7
  end
8
-
8
+
9
9
  should "set the Internationalization code to :de (German)" do
10
10
  Decoder.i18n = :de
11
11
  assert_equal :de, Decoder.i18n
12
12
  assert_nil Decoder.class_eval { @locale }
13
13
  end
14
14
  end
15
-
15
+
16
16
  context "File loading" do
17
17
  setup do
18
18
  Decoder.locale = nil
19
19
  end
20
-
20
+
21
21
  should "only load once" do
22
22
  YAML.expects(:load_file).returns({:en => {"US" => {:name => "United States",
23
23
  :states => {"MA" => "Massachusetts"}}}})
@@ -10,7 +10,7 @@ class StateTest < Test::Unit::TestCase
10
10
  setup do
11
11
  Decoder.i18n = :en
12
12
  end
13
-
13
+
14
14
  context "Getters" do
15
15
  setup do
16
16
  @state = Decoder::State.new(:code => "MA", :name => "Massachusetts")
@@ -25,5 +25,5 @@ class StateTest < Test::Unit::TestCase
25
25
  end
26
26
  end
27
27
  end
28
-
28
+
29
29
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decoder
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 7
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 7
8
- - 1
9
- version: 0.7.1
9
+ - 2
10
+ version: 0.7.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Brian Cardarella
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-06-29 00:00:00 -04:00
18
+ date: 2010-07-23 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: shoulda
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
31
  - 0
29
32
  version: "0"
@@ -68,23 +71,27 @@ rdoc_options:
68
71
  require_paths:
69
72
  - lib
70
73
  required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
71
75
  requirements:
72
76
  - - ">="
73
77
  - !ruby/object:Gem::Version
78
+ hash: 3
74
79
  segments:
75
80
  - 0
76
81
  version: "0"
77
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
78
84
  requirements:
79
85
  - - ">="
80
86
  - !ruby/object:Gem::Version
87
+ hash: 3
81
88
  segments:
82
89
  - 0
83
90
  version: "0"
84
91
  requirements: []
85
92
 
86
93
  rubyforge_project:
87
- rubygems_version: 1.3.6
94
+ rubygems_version: 1.3.7
88
95
  signing_key:
89
96
  specification_version: 3
90
97
  summary: Decoder