super_map 1.0.0 → 1.0.1

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.
data/Rakefile CHANGED
@@ -14,17 +14,16 @@ PKG_FILES = FileList[
14
14
 
15
15
  spec = Gem::Specification.new do |s|
16
16
  s.name = "super_map"
17
- s.version = "1.0.0"
17
+ s.version = "1.0.1"
18
18
  s.author = "Marek Janukowicz"
19
19
  s.email = "marek@janukowicz.net"
20
- s.homepage = ""
20
+ s.homepage = "http://www.bitbucket.org/starware/super_map"
21
21
  s.platform = Gem::Platform::RUBY
22
22
  s.summary = "Swiss army knife of enum-based attributes"
23
23
  s.files = PKG_FILES.to_a
24
24
  s.require_path = "lib"
25
25
  s.has_rdoc = false
26
26
  s.extra_rdoc_files = ["README"]
27
- s.add_dependency "i18n", ">= 0.4.0"
28
27
  end
29
28
 
30
29
  desc 'Create gem'
@@ -1,6 +1,8 @@
1
1
  require 'test/unit'
2
2
  require 'super_map'
3
- I18n.load_path << File.join( File.dirname( __FILE__ ), "en.yml" )
3
+ if defined? I18n
4
+ I18n.load_path << File.join( File.dirname( __FILE__ ), "en.yml" )
5
+ end
4
6
 
5
7
  class SuperMapTest < Test::Unit::TestCase
6
8
 
@@ -21,8 +23,10 @@ class SuperMapTest < Test::Unit::TestCase
21
23
  )
22
24
  assert_equal 'One label', enum_map.first.label
23
25
  assert_equal 'One description', enum_map.first.description
24
- assert_equal 'Two label', enum_map.last.label
25
- assert_equal 'Two description', enum_map.last.description
26
+ if defined? I18n
27
+ assert_equal 'Two label', enum_map.last.label
28
+ assert_equal 'Two description', enum_map.last.description
29
+ end
26
30
  end
27
31
 
28
32
  def test_element_attributes
@@ -78,7 +82,9 @@ class SuperMapTest < Test::Unit::TestCase
78
82
  end
79
83
 
80
84
  def test_labeled_values
81
- assert_equal [["Red", 5], ["Green", 2], ["Blue", 123]], @color_map.labeled_values
85
+ if defined? I18n
86
+ assert_equal [["Red", 5], ["Green", 2], ["Blue", 123]], @color_map.labeled_values
87
+ end
82
88
  end
83
89
 
84
90
  def test_values
@@ -108,8 +114,10 @@ class SuperMapTest < Test::Unit::TestCase
108
114
  end
109
115
 
110
116
  def test_label
111
- assert_equal "Blue", @color_map.label( :blue )
112
- assert_equal "Red", @color_map.label( 5 )
117
+ if defined? I18n
118
+ assert_equal "Blue", @color_map.label( :blue )
119
+ assert_equal "Red", @color_map.label( 5 )
120
+ end
113
121
  end
114
122
 
115
123
  def test_attribute
@@ -1,6 +1,8 @@
1
1
  require 'test/unit'
2
2
  require 'super_map'
3
- I18n.load_path << File.join( File.dirname( __FILE__ ), "en.yml" )
3
+ if defined? I18n
4
+ I18n.load_path << File.join( File.dirname( __FILE__ ), "en.yml" )
5
+ end
4
6
 
5
7
  class SuperMappedAttrTest < Test::Unit::TestCase
6
8
 
@@ -24,7 +26,9 @@ class SuperMappedAttrTest < Test::Unit::TestCase
24
26
 
25
27
  def test_label
26
28
  @user.color_key = :red
27
- assert_equal "Red", @user.color_label
29
+ if defined? I18n
30
+ assert_equal "Red", @user.color_label
31
+ end
28
32
  assert_raise( SuperMap::UnknownKey ) do
29
33
  @user.color_key = :asdjfkajf
30
34
  end
@@ -44,7 +48,9 @@ class SuperMappedAttrTest < Test::Unit::TestCase
44
48
  end
45
49
 
46
50
  def test_map_accessor
47
- assert_equal "Green", User.colors.label( :green )
51
+ if defined? I18n
52
+ assert_equal "Green", User.colors.label( :green )
53
+ end
48
54
  assert_equal 123, User.colors[ :blue ]
49
55
  assert_equal 12, User.colors.attribute( :green, :priority )
50
56
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_map
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marek Janukowicz
@@ -15,25 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-08 00:00:00 +02:00
18
+ date: 2010-09-16 00:00:00 +02:00
19
19
  default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: i18n
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 15
30
- segments:
31
- - 0
32
- - 4
33
- - 0
34
- version: 0.4.0
35
- type: :runtime
36
- version_requirements: *id001
20
+ dependencies: []
21
+
37
22
  description:
38
23
  email: marek@janukowicz.net
39
24
  executables: []
@@ -52,7 +37,7 @@ files:
52
37
  - test/en.yml
53
38
  - test/super_map_test.rb
54
39
  has_rdoc: true
55
- homepage: ""
40
+ homepage: http://www.bitbucket.org/starware/super_map
56
41
  licenses: []
57
42
 
58
43
  post_install_message: