File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ def create_accessors!
163
163
# http://bmorearty.wordpress.com/2009/01/09/fun-with-rubys-instance_eval-and-class_eval/
164
164
def create_accessor_for ( key , val = nil )
165
165
return unless key . to_s =~ /^\w +$/ # could have "some-setting:" which blows up eval
166
- instance_variable_set ( "@#{ key } " , val ) if val
166
+ instance_variable_set ( "@#{ key } " , val )
167
167
self . class . class_eval <<-EndEval
168
168
def #{ key }
169
169
return @#{ key } if @#{ key }
Original file line number Diff line number Diff line change @@ -130,6 +130,18 @@ class NoSource < Settingslogic; end
130
130
Settings . language [ 'some-dash-setting#' ] . should == 'dashtastic'
131
131
end
132
132
133
+ it "should handle settings with nil value" do
134
+ Settings [ "flag" ] = true
135
+ Settings [ "flag" ] = nil
136
+ Settings . flag . should == nil
137
+ end
138
+
139
+ it "should handle settings with false value" do
140
+ Settings [ "flag" ] = true
141
+ Settings [ "flag" ] = false
142
+ Settings . flag . should == false
143
+ end
144
+
133
145
it "should support instance usage as well" do
134
146
settings = SettingsInst . new ( Settings . source )
135
147
settings . setting1 . setting1_child . should == "saweet"
You can’t perform that action at this time.
0 commit comments