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

Fixed some spinach & rspec tests

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