From 430aa23a5b82b34912dc86c323087fabd2849b7c Mon Sep 17 00:00:00 2001 From: Eirik Lygre Date: Wed, 9 Dec 2015 00:20:51 +0100 Subject: Add spinach tests for the clone protocol selection. --- features/explore/projects.feature | 21 +++++++++++++++++++-- features/steps/explore/projects.rb | 8 ++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'features') diff --git a/features/explore/projects.feature b/features/explore/projects.feature index 5d3870827f5..63b0ac65c4b 100644 --- a/features/explore/projects.feature +++ b/features/explore/projects.feature @@ -31,8 +31,17 @@ Feature: Explore Projects Then I should see empty public project details And I should see empty public project details with http clone info - Scenario: I visit an empty public project page as user + Scenario: I visit an empty public project page as user with no ssh-keys Given I sign in as a user + And I have no ssh keys + And public empty project "Empty Public Project" + When I visit empty project page + Then I should see empty public project details + And I should see empty public project details with http clone info + + Scenario: I visit an empty public project page as user with an ssh-key + Given I sign in as a user + And I have ssh key "ssh-rsa Work" And public empty project "Empty Public Project" When I visit empty project page Then I should see empty public project details @@ -57,8 +66,16 @@ Feature: Explore Projects Then I should see project "Community" home page And I should see an http link to the repository - Scenario: I visit public project page as user + Scenario: I visit public project page as user with no ssh-keys + Given I sign in as a user + And I have no ssh keys + When I visit project "Community" page + Then I should see project "Community" home page + And I should see an http link to the repository + + Scenario: I visit public project page as user with an ssh-key Given I sign in as a user + And I have ssh key "ssh-rsa Work" When I visit project "Community" page Then I should see project "Community" home page And I should see an ssh link to the repository diff --git a/features/steps/explore/projects.rb b/features/steps/explore/projects.rb index 8b498e7b4a6..82cb9e24062 100644 --- a/features/steps/explore/projects.rb +++ b/features/steps/explore/projects.rb @@ -144,4 +144,12 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps def public_merge_request @public_merge_request ||= MergeRequest.find_by!(title: 'Bug fix for public project') end + + step 'I have ssh key "ssh-rsa Work"' do + create(:key, user: @user, title: "ssh-rsa Work", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work") + end + + step 'I have no ssh keys' do + Key.delete_all + end end -- cgit v1.2.3