2016-06-02 11:05:42 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
describe 'Dashboard > User filters projects', :feature do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, name: 'Victorialand', namespace: user.namespace) }
|
|
|
|
let(:user2) { create(:user) }
|
|
|
|
let(:project2) { create(:project, name: 'Treasure', namespace: user2.namespace) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
|
|
|
|
login_as(user)
|
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
describe 'filtering personal projects' do
|
|
|
|
before do
|
|
|
|
project2.team << [user, :developer]
|
|
|
|
|
|
|
|
visit dashboard_projects_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters by projects "Owned by me"' do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_link 'Owned by me'
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
expect(page).to have_css('.is-active', text: 'Owned by me')
|
|
|
|
expect(page).to have_content('Victorialand')
|
|
|
|
expect(page).not_to have_content('Treasure')
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
describe 'filtering starred projects', :js do
|
|
|
|
before do
|
|
|
|
user.toggle_star(project)
|
|
|
|
|
|
|
|
visit dashboard_projects_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns message when starred projects fitler returns no results' do
|
|
|
|
fill_in 'project-filter-form-field', with: 'Beta\n'
|
|
|
|
|
|
|
|
expect(page).to have_content('No projects found')
|
|
|
|
expect(page).not_to have_content('You don\'t have starred projects yet')
|
|
|
|
end
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|