blob: c14144ab3d5471f0aa24fa1d8b2eef8ce932b6b3 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# frozen_string_literal: true
require 'spec_helper'
describe 'Explore Groups page', :js do
let!(:user) { create :user }
let!(:group) { create(:group) }
let!(:public_group) { create(:group, :public) }
let!(:private_group) { create(:group, :private) }
let!(:empty_project) { create(:project, group: public_group) }
before do
group.add_owner(user)
sign_in(user)
visit explore_groups_path
wait_for_requests
end
it 'shows groups user is member of' do
expect(page).to have_content(group.full_name)
expect(page).to have_content(public_group.full_name)
expect(page).not_to have_content(private_group.full_name)
end
it 'filters groups' do
fill_in 'filter', with: group.name
wait_for_requests
expect(page).to have_content(group.full_name)
expect(page).not_to have_content(public_group.full_name)
expect(page).not_to have_content(private_group.full_name)
end
it 'resets search when user cleans the input' do
fill_in 'filter', with: group.name
wait_for_requests
expect(page).to have_content(group.full_name)
expect(page).not_to have_content(public_group.full_name)
fill_in 'filter', with: ""
page.find('[name="filter"]').send_keys(:enter)
wait_for_requests
expect(page).to have_content(group.full_name)
expect(page).to have_content(public_group.full_name)
expect(page).not_to have_content(private_group.full_name)
expect(page.all('.js-groups-list-holder .groups-list li').length).to eq 2
end
it 'shows non-archived projects count' do
# Initially project is not archived
expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("1")
# Archive project
::Projects::UpdateService.new(empty_project, user, archived: true).execute
visit explore_groups_path
# Check project count
expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("0")
# Unarchive project
::Projects::UpdateService.new(empty_project, user, archived: false).execute
visit explore_groups_path
# Check project count
expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("1")
end
describe 'landing component' do
it 'shows a landing component' do
expect(page).to have_content('Below you will find all the groups that are public.')
end
it 'is dismissable' do
find('.dismiss-button').click
expect(page).not_to have_content('Below you will find all the groups that are public.')
end
it 'does not show persistently once dismissed' do
find('.dismiss-button').click
visit explore_groups_path
expect(page).not_to have_content('Below you will find all the groups that are public.')
end
end
end
|