2017-03-01 13:31:56 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 04:13:10 +00:00
|
|
|
describe 'Explore Groups page', :js do
|
2017-03-01 13:31:56 +00:00
|
|
|
let!(:user) { create :user }
|
|
|
|
let!(:group) { create(:group) }
|
|
|
|
let!(:public_group) { create(:group, :public) }
|
|
|
|
let!(:private_group) { create(:group, :private) }
|
2017-03-24 20:00:46 +00:00
|
|
|
let!(:empty_project) { create(:empty_project, group: public_group) }
|
2017-03-01 13:31:56 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
group.add_owner(user)
|
|
|
|
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in(user)
|
2017-03-01 13:31:56 +00:00
|
|
|
|
|
|
|
visit explore_groups_path
|
|
|
|
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_groups', with: group.name
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2017-03-01 13:31:56 +00:00
|
|
|
|
|
|
|
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
|
2017-03-02 11:05:48 +00:00
|
|
|
|
|
|
|
it 'resets search when user cleans the input' do
|
|
|
|
fill_in 'filter_groups', with: group.name
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2017-03-02 11:05:48 +00:00
|
|
|
|
|
|
|
fill_in 'filter_groups', with: ""
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2017-03-02 11:05:48 +00:00
|
|
|
|
|
|
|
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 .content-list li').length).to eq 2
|
|
|
|
end
|
2017-03-24 20:00:46 +00:00
|
|
|
|
|
|
|
it 'shows non-archived projects count' do
|
|
|
|
# Initially project is not archived
|
|
|
|
expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("1")
|
2017-05-02 08:05:43 +00:00
|
|
|
|
2017-03-24 20:00:46 +00:00
|
|
|
# Archive project
|
|
|
|
empty_project.archive!
|
|
|
|
visit explore_groups_path
|
|
|
|
|
|
|
|
# Check project count
|
|
|
|
expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("0")
|
2017-05-02 08:05:43 +00:00
|
|
|
|
2017-03-24 20:00:46 +00:00
|
|
|
# Unarchive project
|
|
|
|
empty_project.unarchive!
|
|
|
|
visit explore_groups_path
|
|
|
|
|
|
|
|
# Check project count
|
2017-05-02 08:05:43 +00:00
|
|
|
expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("1")
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'landing component' do
|
|
|
|
it 'should show a landing component' do
|
|
|
|
expect(page).to have_content('Below you will find all the groups that are public.')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should be dismissable' do
|
|
|
|
find('.dismiss-button').click
|
|
|
|
|
|
|
|
expect(page).not_to have_content('Below you will find all the groups that are public.')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should persistently not show 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
|
2017-03-24 20:00:46 +00:00
|
|
|
end
|
2017-03-01 13:31:56 +00:00
|
|
|
end
|