summaryrefslogtreecommitdiff
path: root/test/integration/browser/session_test.rb
blob: 3a41b3a349dd07170eaa1bac2962847c5aec3615 (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
require 'test_helper'

class SessionTest < BrowserIntegrationTest

  setup do
    @username, password = submit_signup
  end

  teardown do
    user = User.find_by_login(@username)
    id = user.identity
    id.destroy
    user.destroy
  end

  test "valid session" do
    assert page.has_content?("Welcome #{@username}")
  end

  test "expired session" do
    assert page.has_content?("Welcome #{@username}")
    pretend_now_is(Time.now + 40.minutes) do
      visit '/'
      assert page.has_no_content?("Welcome #{@username}")
    end
  end
end