aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-12-08 00:18:16 -0500
committerTeddy Wing2015-12-08 00:18:16 -0500
commit22fe7b928b47cbbce4678e1e16311a2cd16088b8 (patch)
tree66e89e38732959467d04710fcec1414c487a8dfc
parent6257500738fadb0d0ef4e161fbe5486f5514d593 (diff)
downloadRuby-Web-Sessions-Exercise-22fe7b928b47cbbce4678e1e16311a2cd16088b8.tar.bz2
Add test that fills in login form
* Write a `setup` method to extract the '/' route visit * Change the logic of `test_index_has_login_form` to check for the presence of 'Login' text and a form (super basic) * Create a new test that fills in the login form and clicks the "Login" button. For now just checks that we get a successful response.
-rw-r--r--test/integration/auth_test.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/integration/auth_test.rb b/test/integration/auth_test.rb
index df60187..f5c94e4 100644
--- a/test/integration/auth_test.rb
+++ b/test/integration/auth_test.rb
@@ -2,8 +2,20 @@ require 'integration_test_helper'
class TestAuth < CapybaraTestCase
- def test_index_has_login_form
+ def setup
visit '/'
+ end
+
+ def test_index_has_login_form
+ assert_text 'Login'
+ assert has_selector?('//form')
+ end
+
+ def test_login
+ fill_in 'username', :with => 'hubertfarnsworth'
+ fill_in 'password', :with => 'secret'
+ click_button 'Login'
+
assert_equal 200, page.status_code
end
end