Skip to content

Instantly share code, notes, and snippets.

@knaveofdiamonds
Created March 9, 2009 20:37
Show Gist options
  • Save knaveofdiamonds/76463 to your computer and use it in GitHub Desktop.
Save knaveofdiamonds/76463 to your computer and use it in GitHub Desktop.
enable :sessions
get "/foo" do
session[:something] = "hello"
"set"
end
get "/bar" do
session[:something]
end
# and the test:
class TestSessions < Test::Unit::TestCase
include Sinatra::Test
def test_session
get "/foo"
assert_equal "set", body
get "/bar"
assert_equal "hello", body # fails - body is ""
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment