Sha256: 18dfd5d3391008f4f3eff4044dd517ee0be3cb11cff823971b10707714c4daf2

Contents?: true

Size: 873 Bytes

Versions: 21

Compression:

Stored size: 873 Bytes

Contents

require 'test_helper'

class AuthenticationTest < ActiveSupport::IntegrationCase

  teardown do
    Capybara.reset_sessions!
  end

  test 'action not requiring authentication' do
    visit articles_path

    assert_equal articles_path, current_path
    within 'h1' do
      assert page.has_content?('Articles')
    end
  end

  test 'action requiring authentication' do
    # try to see page
    visit new_article_path
    
    # test we need to authenticate
    assert_equal sign_in_path, current_path
    within '.flash.notice' do
      assert page.has_content? 'Please sign in first.'
    end

    # sign in
    user_factory 'Bob', 'bob', 'secret'
    sign_in_as 'bob', 'secret'
    visit new_article_path

    # test we can now see page
    assert_equal new_article_path, current_path
    within 'h1' do
      assert page.has_content?('New Article')
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
quo_vadis-1.4.2 test/integration/authenticate_test.rb
quo_vadis-1.4.1 test/integration/authenticate_test.rb
quo_vadis-1.4.0 test/integration/authenticate_test.rb
quo_vadis-1.3.2 test/integration/authenticate_test.rb
quo_vadis-1.3.1 test/integration/authenticate_test.rb
quo_vadis-1.3.0 test/integration/authenticate_test.rb
quo_vadis-1.2.3 test/integration/authenticate_test.rb
quo_vadis-1.2.2 test/integration/authenticate_test.rb
quo_vadis-1.2.1 test/integration/authenticate_test.rb
quo_vadis-1.2.0 test/integration/authenticate_test.rb
quo_vadis-1.1.2 test/integration/authenticate_test.rb
quo_vadis-1.1.1 test/integration/authenticate_test.rb
quo_vadis-1.1.0 test/integration/authenticate_test.rb
quo_vadis-1.0.7 test/integration/authenticate_test.rb
quo_vadis-1.0.6 test/integration/authenticate_test.rb
quo_vadis-1.0.5 test/integration/authenticate_test.rb
quo_vadis-1.0.4 test/integration/authenticate_test.rb
quo_vadis-1.0.3 test/integration/authenticate_test.rb
quo_vadis-1.0.2 test/integration/authenticate_test.rb
quo_vadis-1.0.1 test/integration/authenticate_test.rb