2014-09-02 18:07:02 +05:30
|
|
|
class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
|
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
|
|
|
|
|
|
|
step 'project has deploy key' do
|
|
|
|
create(:deploy_keys_project, project: @project)
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see project deploy key' do
|
2016-06-02 11:05:42 +05:30
|
|
|
page.within '.deploy-keys' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content deploy_key.title
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see other project deploy key' do
|
2016-06-02 11:05:42 +05:30
|
|
|
page.within '.deploy-keys' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content other_deploy_key.title
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see public deploy key' do
|
2016-06-02 11:05:42 +05:30
|
|
|
page.within '.deploy-keys' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content public_deploy_key.title
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
step 'I click \'New Deploy Key\'' do
|
|
|
|
click_link 'New Deploy Key'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I submit new deploy key' do
|
|
|
|
fill_in "deploy_key_title", with: "laptop"
|
|
|
|
fill_in "deploy_key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop"
|
2016-06-02 11:05:42 +05:30
|
|
|
click_button "Add key"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should be on deploy keys page' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(current_path).to eq namespace_project_deploy_keys_path(@project.namespace, @project)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see newly created deploy key' do
|
2016-06-02 11:05:42 +05:30
|
|
|
page.within '.deploy-keys' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content(deploy_key.title)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
step 'other projects have deploy keys' do
|
|
|
|
@second_project = create(:project, namespace: create(:group))
|
2014-09-02 18:07:02 +05:30
|
|
|
@second_project.team << [current_user, :master]
|
|
|
|
create(:deploy_keys_project, project: @second_project)
|
2015-09-11 14:41:01 +05:30
|
|
|
|
|
|
|
@third_project = create(:project, namespace: create(:group))
|
|
|
|
@third_project.team << [current_user, :master]
|
|
|
|
create(:deploy_keys_project, project: @third_project, deploy_key: @second_project.deploy_keys.first)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should only see the same deploy key once' do
|
2016-06-02 11:05:42 +05:30
|
|
|
page.within '.deploy-keys' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_selector('ul li', count: 1)
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'public deploy key exists' do
|
|
|
|
create(:deploy_key, public: true)
|
|
|
|
end
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
step 'I click attach deploy key' do
|
2016-06-02 11:05:42 +05:30
|
|
|
page.within '.deploy-keys' do
|
2014-09-02 18:07:02 +05:30
|
|
|
click_link 'Enable'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def deploy_key
|
|
|
|
@project.deploy_keys.last
|
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
|
|
|
|
def other_deploy_key
|
|
|
|
@second_project.deploy_keys.last
|
|
|
|
end
|
|
|
|
|
|
|
|
def public_deploy_key
|
|
|
|
DeployKey.are_public.last
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|