Commit 357ab10d authored by Phil Hughes's avatar Phil Hughes

Fixed some spinach & rspec tests

parent 0b7824d4
......@@ -77,7 +77,7 @@
</script>
<template>
<div class="col-lg-9 col-lg-offset-3 append-bottom-default">
<div class="col-lg-9 col-lg-offset-3 append-bottom-default deploy-keys">
<div
class="text-center"
v-if="isLoading && !hasKeys">
......
......@@ -3,28 +3,33 @@ Feature: Project Deploy Keys
Given I sign in as a user
And I own project "Shop"
@javascript
Scenario: I should see deploy keys list
Given project has deploy key
When I visit project deploy keys page
Then I should see project deploy key
@javascript
Scenario: I should see project deploy keys
Given other projects have deploy keys
When I visit project deploy keys page
Then I should see other project deploy key
And I should only see the same deploy key once
@javascript
Scenario: I should see public deploy keys
Given public deploy key exists
When I visit project deploy keys page
Then I should see public deploy key
@javascript
Scenario: I add new deploy key
Given I visit project deploy keys page
And I submit new deploy key
Then I should be on deploy keys page
And I should see newly created deploy key
@javascript
Scenario: I attach other project deploy key to project
Given other projects have deploy keys
And I visit project deploy keys page
......@@ -32,6 +37,7 @@ Feature: Project Deploy Keys
Then I should be on deploy keys page
And I should see newly created deploy key
@javascript
Scenario: I attach public deploy key to project
Given public deploy key exists
And I visit project deploy keys page
......
......@@ -8,19 +8,19 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
step 'I should see project deploy key' do
page.within '.deploy-keys' do
page.within(find('.deploy-keys')) do
expect(page).to have_content deploy_key.title
end
end
step 'I should see other project deploy key' do
page.within '.deploy-keys' do
page.within(find('.deploy-keys')) do
expect(page).to have_content other_deploy_key.title
end
end
step 'I should see public deploy key' do
page.within '.deploy-keys' do
page.within(find('.deploy-keys')) do
expect(page).to have_content public_deploy_key.title
end
end
......@@ -40,7 +40,8 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
step 'I should see newly created deploy key' do
page.within '.deploy-keys' do
@project.reload
page.within(find('.deploy-keys')) do
expect(page).to have_content(deploy_key.title)
end
end
......@@ -56,7 +57,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
step 'I should only see the same deploy key once' do
page.within '.deploy-keys' do
page.within(find('.deploy-keys')) do
expect(page).to have_selector('ul li', count: 1)
end
end
......@@ -66,8 +67,9 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
step 'I click attach deploy key' do
page.within '.deploy-keys' do
click_link 'Enable'
page.within(find('.deploy-keys')) do
click_button 'Enable'
expect(page).not_to have_selector('.fa-spinner')
end
end
......
require 'spec_helper'
describe 'Project deploy keys', feature: true do
describe 'Project deploy keys', :js, :feature do
let(:user) { create(:user) }
let(:project) { create(:project_empty_repo) }
......@@ -17,9 +17,13 @@ describe 'Project deploy keys', feature: true do
it 'removes association between project and deploy key' do
visit namespace_project_settings_repository_path(project.namespace, project)
page.within '.deploy-keys' do
expect { click_on 'Remove' }
.to change { project.deploy_keys.count }.by(-1)
page.within(find('.deploy-keys')) do
expect(page).to have_selector('.deploy-keys li', count: 1)
click_on 'Remove'
expect(page).not_to have_selector('.fa-spinner', count: 0)
expect(page).to have_selector('.deploy-keys li', count: 0)
end
end
end
......
require 'spec_helper'
describe DeployKeyEntity do
include RequestAwareEntity
let(:user) { create(:user) }
let(:project) { create(:empty_project, :internal)}
let(:project_private) { create(:empty_project, :private)}
......@@ -22,7 +24,12 @@ describe DeployKeyEntity do
created_at: deploy_key.created_at,
updated_at: deploy_key.updated_at,
projects: [
{ id: project.id, name: project.name, full_path: project.full_path, full_name: project.full_name }
{
id: project.id,
name: project.name,
full_path: namespace_project_path(project.namespace, project),
full_name: project.full_name
}
]
}
......
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