summaryrefslogtreecommitdiff
path: root/spec/features/explore/user_explores_projects_spec.rb
blob: c724c3d17f80d67615dab91b1467a5bfed3ddde9 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'spec_helper'

describe 'User explores projects' do
  set(:archived_project) { create(:project, :archived) }
  set(:internal_project) { create(:project, :internal) }
  set(:private_project) { create(:project, :private) }
  set(:public_project) { create(:project, :public) }

  context 'when not signed in' do
    context 'when viewing public projects' do
      before do
        visit(explore_projects_path)
      end

      include_examples 'shows public projects'
    end
  end

  context 'when signed in' do
    set(:user) { create(:user) }

    before do
      sign_in(user)
    end

    context 'when viewing public projects' do
      before do
        visit(explore_projects_path)
      end

      include_examples 'shows public and internal projects'
    end

    context 'when viewing most starred projects' do
      before do
        visit(starred_explore_projects_path)
      end

      include_examples 'shows public and internal projects'
    end

    context 'when viewing trending projects' do
      before do
        [archived_project, public_project].each { |project| create(:note_on_issue, project: project) }

        TrendingProject.refresh!

        visit(trending_explore_projects_path)
      end

      include_examples 'shows public projects'
    end
  end
end