forked from camping/camping
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require File.dirname(__FILE__) + '/test_helper' | ||
require 'camping' | ||
require 'camping/session' | ||
|
||
Camping.goes :Sessions | ||
|
||
module Sessions | ||
include Camping::Session | ||
end | ||
|
||
module Sessions::Controllers | ||
class One | ||
def get | ||
@state.clear | ||
@state.one = 42 | ||
redirect R(Two) | ||
end | ||
end | ||
|
||
class Two | ||
def get | ||
@state.two = 56 | ||
redirect R(Three) | ||
end | ||
end | ||
|
||
class Three | ||
def get | ||
@state.three = 99 | ||
@state.values_at("one", "two", "three").inspect | ||
end | ||
end | ||
end | ||
|
||
class Sessions::Test < TestCase | ||
def test_session | ||
get '/one' | ||
follow_redirect! | ||
|
||
get '/two' | ||
follow_redirect! | ||
|
||
get '/three' | ||
assert_body "[42, 56, 99]" | ||
end | ||
end |