Skip to content


Subversion checkout URL

You can clone with
Download ZIP


fix for issue #11 - ZenTest conflict with .name property of Settingslogic class #19

1 commit merged into from

1 participant


I ran into the same problem with ZenTest autotester throwing stacks to stdout when it tries to call during its traversal of ObjectSpace. It annoyingly pollutes my console window...

Allowing name as a setting value is a very useful feature, so I enhanced the conditional to prevent calling instance when name is called directly on Settingslogic.

Tests are updated to include a test for the existing .name behavior and the desired behavior when calling the superclass.

@ghost ghost merged commit 794a03b into binarylogic:master
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 2, 2011
  1. @goosetav

    fixes settingslogic #11

    goosetav authored
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 1 deletion.
  1. +1 −1  lib/settingslogic.rb
  2. +17 −0 spec/settingslogic_spec.rb
2  lib/settingslogic.rb
@@ -7,7 +7,7 @@ class MissingSetting < StandardError; end
class << self
def name # :nodoc:
- instance.key?("name") ? : super
+ self.superclass != Hash && instance.key?("name") ? : super
# Enables Settings.get('') for dynamic access
17 spec/settingslogic_spec.rb
@@ -133,9 +133,26 @@ class NoSource < Settingslogic; end
Settings.get('setting1.deep.child.value').should == 2
+ # If .name is not a property, delegate to superclass
+ it "should respond with" do
+ == "Settings2"
+ end
+ # If .name is called on Settingslogic itself, handle appropriately
+ # by delegating to Hash
+ it "should have the parent class always respond with" do
+ == 'Settingslogic'
+ end
+ # If .name is a property, respond with that instead of delegating to superclass
+ it "should allow a name setting to be overriden" do
+ == 'test'
+ end
# Put this test last or else call to .instance will load @instance,
# masking bugs.
it "should be a hash" do
Settings.send(:instance).should be_is_a(Hash)
Something went wrong with that request. Please try again.