summaryrefslogtreecommitdiff
path: root/spec/features/users/show_spec.rb
blob: 3e2fb704bc6b3d6be257f6eb71a7c91114d59529 (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
30
31
32
33
34
35
36
37
38
39
40
41
require 'spec_helper'

describe 'User page' do
  let(:user) { create(:user) }

  it 'shows all the tabs' do
    visit(user_path(user))

    page.within '.nav-links' do
      expect(page).to have_link('Activity')
      expect(page).to have_link('Groups')
      expect(page).to have_link('Contributed projects')
      expect(page).to have_link('Personal projects')
      expect(page).to have_link('Snippets')
    end
  end

  context 'signup disabled' do
    it 'shows the sign in link' do
      stub_application_setting(signup_enabled: false)

      visit(user_path(user))

      page.within '.navbar-nav' do
        expect(page).to have_link('Sign in')
      end
    end
  end

  context 'signup enabled' do
    it 'shows the sign in and register link' do
      stub_application_setting(signup_enabled: true)

      visit(user_path(user))

      page.within '.navbar-nav' do
        expect(page).to have_link('Sign in / Register')
      end
    end
  end
end