From 22fe7b928b47cbbce4678e1e16311a2cd16088b8 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 8 Dec 2015 00:18:16 -0500 Subject: 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. --- test/integration/auth_test.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'test') 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 -- cgit v1.2.3