aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-12-08 01:29:13 -0500
committerTeddy Wing2015-12-08 01:29:47 -0500
commit8513c8d87e21ab477a438962bac8ad63c8987789 (patch)
tree09abab61c381b5349235c05717a3b67915ac3194
parenta6c33077c7ac124e6c4db6ad272ab67226aba354 (diff)
downloadRuby-Web-Sessions-Exercise-8513c8d87e21ab477a438962bac8ad63c8987789.tar.bz2
Add logged_in.erb template
Template that displays when the user is logged in. Adjust the login test to check for the text in this template.
-rw-r--r--app.rb2
-rw-r--r--test/integration/auth_test.rb1
-rw-r--r--views/logged_in.erb1
3 files changed, 3 insertions, 1 deletions
diff --git a/app.rb b/app.rb
index ef95715..dabcf22 100644
--- a/app.rb
+++ b/app.rb
@@ -5,7 +5,7 @@ use Rack::Session::Cookie, :secret => "My session secret which shouldn't be comm
get '/' do
if session[:user]
- "Logged in with user id #{session[:user]}"
+ erb :logged_in
else
erb :index
end
diff --git a/test/integration/auth_test.rb b/test/integration/auth_test.rb
index 285fdbe..7fa2950 100644
--- a/test/integration/auth_test.rb
+++ b/test/integration/auth_test.rb
@@ -30,6 +30,7 @@ class TestAuth < CapybaraTestCase
login_with_correct_credentials
assert_equal 200, page.status_code
+ assert_text "You're logged in!"
end
def test_logout
diff --git a/views/logged_in.erb b/views/logged_in.erb
new file mode 100644
index 0000000..df9b7f4
--- /dev/null
+++ b/views/logged_in.erb
@@ -0,0 +1 @@
+You're logged in!