Sha256: bd962d73aa5d25ab5354cee349fc5e7b0c2897906247bb4fc75a8229428b55d0

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe 'Session overview' do
  include CASino::Engine.routes.url_helpers

  subject { page }

  context 'when logged in' do
    before do
      sign_in
      visit sessions_path
    end

    it { should have_link('Logout', href: logout_path) }
    it { should have_text('Your Active Sessions') }
    it { should have_text('Active Session') }

    context 'without other sessions' do
      it { should_not have_link('End session') }
    end

    context 'when other sessions exist' do
      before do
        in_browser(:other) do
          sign_in
        end
        visit sessions_path
      end
      it { should have_link('End session') }
    end

    context 'with two-factor authentication disabled' do
      before do
        in_browser(:other) do
          sign_in
        end
        visit sessions_path
      end
      it { should have_link('Enable', href: new_two_factor_authenticator_path) }
      it { should_not have_link('Disable') }
    end

    context 'with two-factor authentication enabled' do
      before { enable_two_factor_authentication }
      it { should_not have_link('Enable', href: new_two_factor_authenticator_path) }
      it { should have_link('Disable') }
    end
  end

  context 'when not logged in' do
    before { visit sessions_path }

    it { should have_button('Login') }
    its(:current_path) { should == login_path }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
casino-2.0.1 spec/features/session_overview_spec.rb
casino-2.0.0 spec/features/session_overview_spec.rb
casino-1.3.2 spec/features/session_overview_spec.rb
casino-1.3.1 spec/features/session_overview_spec.rb