aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/integration/auth_test.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/test/integration/auth_test.rb b/test/integration/auth_test.rb
index 87d1fb5..3e98788 100644
--- a/test/integration/auth_test.rb
+++ b/test/integration/auth_test.rb
@@ -2,27 +2,32 @@ require 'integration_test_helper'
class TestAuth < CapybaraTestCase
- def setup
+ 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
- fill_in 'username', :with => 'unregistered'
- fill_in 'password', :with => 'password'
- click_button 'Login'
+ login('unregistered', 'password')
assert_text 'Unrecognized user'
end
def test_login
- fill_in 'username', :with => 'hubertfarnsworth'
- fill_in 'password', :with => 'secret'
- click_button 'Login'
+ login_with_correct_credentials
assert_equal 200, page.status_code
end