Commit 94dc9ef9 authored by Eirik Lygre's avatar Eirik Lygre

Move ssh-key steps into SharedUser. Change references in "Explore Projects"...

Move ssh-key steps into SharedUser. Change references in "Explore Projects" feature. Apply ssh-key requirement to "Project Create" feature.
parent 430aa23a
...@@ -41,7 +41,7 @@ Feature: Explore Projects ...@@ -41,7 +41,7 @@ Feature: Explore Projects
Scenario: I visit an empty public project page as user with an ssh-key Scenario: I visit an empty public project page as user with an ssh-key
Given I sign in as a user Given I sign in as a user
And I have ssh key "ssh-rsa Work" And I have an ssh key
And public empty project "Empty Public Project" And public empty project "Empty Public Project"
When I visit empty project page When I visit empty project page
Then I should see empty public project details Then I should see empty public project details
...@@ -75,7 +75,7 @@ Feature: Explore Projects ...@@ -75,7 +75,7 @@ Feature: Explore Projects
Scenario: I visit public project page as user with an ssh-key Scenario: I visit public project page as user with an ssh-key
Given I sign in as a user Given I sign in as a user
And I have ssh key "ssh-rsa Work" And I have an ssh key
When I visit project "Community" page When I visit project "Community" page
Then I should see project "Community" home page Then I should see project "Community" home page
And I should see an ssh link to the repository And I should see an ssh link to the repository
......
...@@ -7,6 +7,7 @@ Feature: Project Create ...@@ -7,6 +7,7 @@ Feature: Project Create
Scenario: User create a project Scenario: User create a project
Given I sign in as a user Given I sign in as a user
When I visit new project page When I visit new project page
And I have an ssh key
And fill project form with valid data And fill project form with valid data
Then I should see project page Then I should see project page
And I should see empty project instuctions And I should see empty project instuctions
...@@ -14,6 +15,7 @@ Feature: Project Create ...@@ -14,6 +15,7 @@ Feature: Project Create
@javascript @javascript
Scenario: Empty project instructions Scenario: Empty project instructions
Given I sign in as a user Given I sign in as a user
And I have an ssh key
When I visit new project page When I visit new project page
And fill project form with valid data And fill project form with valid data
Then I see empty project instuctions Then I see empty project instuctions
......
...@@ -2,6 +2,7 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps ...@@ -2,6 +2,7 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
include SharedPaths include SharedPaths
include SharedProject include SharedProject
include SharedUser
step 'I should see project "Empty Public Project"' do step 'I should see project "Empty Public Project"' do
expect(page).to have_content "Empty Public Project" expect(page).to have_content "Empty Public Project"
...@@ -144,12 +145,4 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps ...@@ -144,12 +145,4 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
def public_merge_request def public_merge_request
@public_merge_request ||= MergeRequest.find_by!(title: 'Bug fix for public project') @public_merge_request ||= MergeRequest.find_by!(title: 'Bug fix for public project')
end 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 end
class Spinach::Features::ProjectCreate < Spinach::FeatureSteps class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
include SharedPaths include SharedPaths
include SharedUser
step 'fill project form with valid data' do step 'fill project form with valid data' do
fill_in 'project_path', with: 'Empty' fill_in 'project_path', with: 'Empty'
......
...@@ -18,4 +18,12 @@ module SharedUser ...@@ -18,4 +18,12 @@ module SharedUser
def user_exists(name, options = {}) def user_exists(name, options = {})
User.find_by(name: name) || create(:user, { name: name, admin: false }.merge(options)) User.find_by(name: name) || create(:user, { name: name, admin: false }.merge(options))
end end
step 'I have an ssh key' do
create(:key, user: @user, title: "An ssh-key", 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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment