diff options
| author | Teddy Wing | 2015-12-08 01:38:50 -0500 |
|---|---|---|
| committer | Teddy Wing | 2015-12-08 01:38:50 -0500 |
| commit | f3a35d4ff0606ea59aecd67c5daa01ccf51b01a8 (patch) | |
| tree | 12c31a367ca070ddab24f42438c379d91ebcc1ff /test/integration | |
| parent | f6b6a0ddd8cb1bf45190a8f204b0903da8e9ba40 (diff) | |
| download | Ruby-Web-Sessions-Exercise-f3a35d4ff0606ea59aecd67c5daa01ccf51b01a8.tar.bz2 | |
Add test/ from branch 'solution'
Diffstat (limited to 'test/integration')
| -rw-r--r-- | test/integration/auth_test.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/integration/auth_test.rb b/test/integration/auth_test.rb new file mode 100644 index 0000000..7fa2950 --- /dev/null +++ b/test/integration/auth_test.rb @@ -0,0 +1,43 @@ +require 'integration_test_helper' + + +class TestAuth < CapybaraTestCase + def login(username, password) + visit '/' + fill_in 'username', :with => username + fill_in 'password', :with => password + click_button 'Login' + end + + def login_with_correct_credentials + login('hubertfarnsworth', 'secret') + end + + + def test_index_has_login_form + visit '/' + assert_text 'Login' + assert has_selector?('//form') + end + + def test_unrecognised_user_login + login('unregistered', 'password') + + assert_text 'Unrecognized user' + end + + def test_login + login_with_correct_credentials + + assert_equal 200, page.status_code + assert_text "You're logged in!" + end + + def test_logout + login_with_correct_credentials + visit '/logout' + + assert_text 'Login' + assert_equal '/', current_path + end +end |
