Skip to content

Commit bd5f2b0

Browse files
committed
Add test about no warnings emitting at lazy initialization of an instance variable
1 parent 733800b commit bd5f2b0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

spec/ruby/language/variables_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,5 +842,12 @@ def obj.foobar; a = @a; end
842842
-> { obj.foobar }.should_not complain(verbose: true)
843843
end
844844
end
845+
846+
it "doesn't warn at lazy initialization" do
847+
obj = Object.new
848+
def obj.foobar; @a ||= 42; end
849+
850+
-> { obj.foobar }.should_not complain(verbose: true)
851+
end
845852
end
846853
end

0 commit comments

Comments
 (0)