From e0c07b5e3d1e14fa6efda3c13db46477d79c7c34 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Fri, 22 Apr 2016 06:19:43 -0500 Subject: Add tests for filtering owned projects --- .../dashboard/user_filters_projects_spec.rb | 27 +++++++++++++++++++ spec/features/dashboard_filter_spec.rb | 30 ---------------------- 2 files changed, 27 insertions(+), 30 deletions(-) create mode 100644 spec/features/dashboard/user_filters_projects_spec.rb delete mode 100644 spec/features/dashboard_filter_spec.rb (limited to 'spec') diff --git a/spec/features/dashboard/user_filters_projects_spec.rb b/spec/features/dashboard/user_filters_projects_spec.rb new file mode 100644 index 00000000000..cf86e2c85e9 --- /dev/null +++ b/spec/features/dashboard/user_filters_projects_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe "Dashboard > User filters projects", feature: true do + + describe 'filtering personal projects' do + 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) + 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" + + 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 +end diff --git a/spec/features/dashboard_filter_spec.rb b/spec/features/dashboard_filter_spec.rb deleted file mode 100644 index 3d20813161a..00000000000 --- a/spec/features/dashboard_filter_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'spec_helper' - -describe "Dashboard projects filters", feature: true, js: true do - - context 'filtering personal projects' do - before do - user = create(:user) - project = create(:project, name: "Victorialand", namespace: user.namespace) - project.team << [user, :master] - - login_as(user) - visit dashboard_projects_path - - open_filter_dropdown - click_link "Owned by me" - end - - it 'filters by projects "Owned by me"' do - sleep 1 - open_filter_dropdown - page.within('ul.dropdown-menu.dropdown-menu-align-right') do - expect(page).to have_css('.is-active', text: 'Owned by me') - end - end - end - - def open_filter_dropdown - find('button.dropdown-toggle.btn').click - end -end -- cgit v1.2.1