summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-04-28 20:59:20 +0100
committerPhil Hughes <me@iamphill.com>2017-04-28 20:59:20 +0100
commit357ab10da34102499a32ad569d9b58c8d5b97d17 (patch)
tree00fd99161d55174097298604dc1222dd836f251e
parent0b7824d433ec5029da17114389f425f816b7be74 (diff)
downloadgitlab-ce-357ab10da34102499a32ad569d9b58c8d5b97d17.tar.gz
Fixed some spinach & rspec tests
-rw-r--r--app/assets/javascripts/deploy_keys/components/app.vue2
-rw-r--r--features/project/deploy_keys.feature6
-rw-r--r--features/steps/project/deploy_keys.rb16
-rw-r--r--spec/features/projects/deploy_keys_spec.rb12
-rw-r--r--spec/serializers/deploy_key_entity_spec.rb9
5 files changed, 32 insertions, 13 deletions
diff --git a/app/assets/javascripts/deploy_keys/components/app.vue b/app/assets/javascripts/deploy_keys/components/app.vue
index ee2f85bde53..2ba5001cf56 100644
--- a/app/assets/javascripts/deploy_keys/components/app.vue
+++ b/app/assets/javascripts/deploy_keys/components/app.vue
@@ -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">
diff --git a/features/project/deploy_keys.feature b/features/project/deploy_keys.feature
index 960b4100ee5..6f1ed9ff5b6 100644
--- a/features/project/deploy_keys.feature
+++ b/features/project/deploy_keys.feature
@@ -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
diff --git a/features/steps/project/deploy_keys.rb b/features/steps/project/deploy_keys.rb
index ec59a2c094e..8ad9d4a4741 100644
--- a/features/steps/project/deploy_keys.rb
+++ b/features/steps/project/deploy_keys.rb
@@ -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
diff --git a/spec/features/projects/deploy_keys_spec.rb b/spec/features/projects/deploy_keys_spec.rb
index 0b997f130ea..06abfbbc86b 100644
--- a/spec/features/projects/deploy_keys_spec.rb
+++ b/spec/features/projects/deploy_keys_spec.rb
@@ -1,6 +1,6 @@
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
diff --git a/spec/serializers/deploy_key_entity_spec.rb b/spec/serializers/deploy_key_entity_spec.rb
index cc3fb193f1b..e73fbe190ca 100644
--- a/spec/serializers/deploy_key_entity_spec.rb
+++ b/spec/serializers/deploy_key_entity_spec.rb
@@ -1,6 +1,8 @@
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
+ }
]
}