From 62f4a9de1997fb1281e4d73753d157d2e29940c4 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Mon, 22 Feb 2016 17:37:26 +0000 Subject: [PATCH 1/2] Users don't get instructions to push to other users empty projects Fixes #12518 --- app/views/projects/empty.html.haml | 2 +- features/explore/projects.feature | 1 + features/project/project.feature | 10 ++++++++++ features/steps/project/project.rb | 10 ++++++++++ features/steps/shared/paths.rb | 4 ++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml index b34d106d56..6ad7b05155 100644 --- a/app/views/projects/empty.html.haml +++ b/app/views/projects/empty.html.haml @@ -18,7 +18,7 @@ = link_to "adding README", new_readme_path, class: 'underlined-link' file to this project. -- if can?(current_user, :download_code, @project) +- if can?(current_user, :push_code, @project) %div{ class: container_class } .prepend-top-20 .empty_wrapper diff --git a/features/explore/projects.feature b/features/explore/projects.feature index 629859e960..7df6b6f09b 100644 --- a/features/explore/projects.feature +++ b/features/explore/projects.feature @@ -87,6 +87,7 @@ Feature: Explore Projects Scenario: I visit public project issues page as a non authorized user Given I visit project "Community" page + Then I should not see command line instructions And I visit "Community" issues page Then I should see list of issues for "Community" project diff --git a/features/project/project.feature b/features/project/project.feature index 1a53945eb0..c1e04ada7c 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -86,3 +86,13 @@ Feature: Project Given I click notifications drop down button When I choose Mention setting Then I should see Notification saved message + + Scenario: I should see command line instructions + Given I own an empty project + And I visit my empty project page + And I create bare repo + Then I should see command line instructions + + Scenario: I should not see command line instructions + Given I visit an empty project page + Then I should not see command line instructions diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index 37bf52b4a9..ef185861e0 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -144,4 +144,14 @@ class Spinach::Features::Project < Spinach::FeatureSteps expect(page).to have_content 'Notification settings saved' end end + + step 'I create bare repo' do + click_link 'Create empty bare repository' + end + + step 'I should see command line instructions' do + page.within ".empty_wrapper" do + expect(page).to have_content("Command line instructions") + end + end end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index f4df4874d2..0f9835e735 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -447,6 +447,10 @@ module SharedPaths visit namespace_project_path(project.namespace, project) end + step "I should not see command line instructions" do + expect(page).not_to have_css('.empty_wrapper') + end + # ---------------------------------------- # Public Projects # ---------------------------------------- From 3ec1bffc6c902fa04d7d4281b26225a9d640424e Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 23 Feb 2016 08:42:29 +0000 Subject: [PATCH 2/2] fix failing tests --- features/project/project.feature | 4 ---- features/steps/explore/projects.rb | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/features/project/project.feature b/features/project/project.feature index c1e04ada7c..f1f3ed2606 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -92,7 +92,3 @@ Feature: Project And I visit my empty project page And I create bare repo Then I should see command line instructions - - Scenario: I should not see command line instructions - Given I visit an empty project page - Then I should not see command line instructions diff --git a/features/steps/explore/projects.rb b/features/steps/explore/projects.rb index 742ba5d71f..cb6fa8a47d 100644 --- a/features/steps/explore/projects.rb +++ b/features/steps/explore/projects.rb @@ -18,7 +18,7 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps end step 'I should see empty public project details' do - expect(page).to have_content 'Git global setup' + expect(page).not_to have_content 'Git global setup' end step 'I should see empty public project details with http clone info' do