aboutsummaryrefslogtreecommitdiffstats
path: root/test/integration/auth_test.rb
blob: 87d1fb51b610ec58de5f380bc7869af55fe3e5f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'integration_test_helper'


class TestAuth < CapybaraTestCase
  def setup
    visit '/'
  end

  def test_index_has_login_form
    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'

    assert_text 'Unrecognized user'
  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