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