From 8513c8d87e21ab477a438962bac8ad63c8987789 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 8 Dec 2015 01:29:13 -0500 Subject: 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. --- app.rb | 2 +- test/integration/auth_test.rb | 1 + views/logged_in.erb | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 views/logged_in.erb 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! -- cgit v1.2.3