diff --git a/lib/rack/test/methods.rb b/lib/rack/test/methods.rb index 052fd11..4392a33 100644 --- a/lib/rack/test/methods.rb +++ b/lib/rack/test/methods.rb @@ -55,7 +55,7 @@ def current_session # Create a new session (or reuse an existing session with the given name), # and make it the current session for the given block. def with_session(name) - session = @_rack_test_current_session + session = _rack_test_current_session yield(@_rack_test_current_session = rack_test_session(name)) ensure @_rack_test_current_session = session @@ -86,6 +86,10 @@ def digest_authorize(username, password) # :nodoc: :last_response, :last_request, ) + + # Private accessor to avoid uninitialized instance variable warning in Ruby 2.* + attr_accessor :_rack_test_current_session + private :_rack_test_current_session end end end