tpitale-constant_cache 0.1.1 → 0.1.2

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.
@@ -59,13 +59,8 @@ module ConstantCache
59
59
  # Create a constant on the class that pointing to an instance
60
60
  #
61
61
  def set_instance_as_constant
62
- unless constant_name.nil?
63
- if self.class.const_defined?(constant_name)
64
- msg = "Constant #{self.class.to_s}::#{constant_name} has already been defined"
65
- raise ConstantCache::DuplicateConstantError, msg
66
- else
67
- self.class.const_set(constant_name, self)
68
- end
62
+ unless constant_name.nil? || self.class.const_defined?(constant_name)
63
+ self.class.const_set(constant_name, self)
69
64
  end
70
65
  end
71
66
 
@@ -3,7 +3,7 @@ module ConstantCache
3
3
  module Version #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- TINY = 1
6
+ TINY = 2
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
@@ -61,9 +61,9 @@ class CacheMethodsTest < Test::Unit::TestCase
61
61
  Cached.constants.size.should == size
62
62
  end
63
63
 
64
- should "raise an exception on duplicate constant" do
64
+ should "not raise an exception on duplicate constant" do
65
65
  @cached.name = 'buffalo'
66
- assert_raises ConstantCache::DuplicateConstantError do
66
+ assert_nothing_raised do
67
67
  @cached.set_instance_as_constant
68
68
  @cached.set_instance_as_constant
69
69
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tpitale-constant_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Reagan