Fix wrong message on starred projects filtering

This commit is contained in:
George Andrinopoulos 2017-03-09 01:29:11 +00:00 committed by Rémy Coutable
parent 71d371cf89
commit 71eeb86327
3 changed files with 33 additions and 10 deletions

View file

@ -6,7 +6,7 @@
- if @last_push
= render "events/event_last_push", event: @last_push
- if @projects.any?
- if @projects.any? || params[:filter_projects]
= render 'projects'
- else
%h3 You don't have starred projects yet

View file

@ -0,0 +1,4 @@
---
title: Fix wrong message on starred projects filtering
merge_request:
author: George Andrinopoulos

View file

@ -1,26 +1,45 @@
require 'spec_helper'
describe "Dashboard > User filters projects", feature: true do
describe 'filtering personal projects' do
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
user = create(:user)
project = create(:project, name: "Victorialand", namespace: user.namespace)
project.team << [user, :master]
user2 = create(:user)
project2 = create(:project, name: "Treasure", namespace: user2.namespace)
login_as(user)
end
describe 'filtering personal projects' do
before do
project2.team << [user, :developer]
login_as(user)
visit dashboard_projects_path
end
it 'filters by projects "Owned by me"' do
click_link "Owned by me"
click_link 'Owned by me'
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
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
end