Commit 9b362407 authored by Douwe Maan's avatar Douwe Maan

Add project deploy keys tests.

parent ed097df6
...@@ -6,7 +6,17 @@ Feature: Project Deploy Keys ...@@ -6,7 +6,17 @@ Feature: Project Deploy Keys
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 keys Then I should see project deploy key
Scenario: I should see project deploy keys
Given other project has deploy key
When I visit project deploy keys page
Then I should see other project deploy key
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
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
...@@ -15,9 +25,16 @@ Feature: Project Deploy Keys ...@@ -15,9 +25,16 @@ 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
Scenario: I attach deploy key to project Scenario: I attach other project deploy key to project
Given other project has deploy key Given other project has deploy key
And I visit project deploy keys page And I visit project deploy keys page
When I click attach deploy key When I click attach 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
Scenario: I attach public deploy key to project
Given public deploy key exists
And I visit project deploy keys page
When I click attach deploy key
Then I should be on deploy keys page
And I should see newly created deploy key
...@@ -7,12 +7,24 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps ...@@ -7,12 +7,24 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
create(:deploy_keys_project, project: @project) create(:deploy_keys_project, project: @project)
end end
step 'I should see project deploy keys' do step 'I should see project deploy key' do
within '.enabled-keys' do within '.enabled-keys' do
page.should have_content deploy_key.title page.should have_content deploy_key.title
end end
end end
step 'I should see other project deploy key' do
within '.available-keys' do
page.should have_content other_deploy_key.title
end
end
step 'I should see public deploy key' do
within '.available-keys' do
page.should have_content public_deploy_key.title
end
end
step 'I click \'New Deploy Key\'' do step 'I click \'New Deploy Key\'' do
click_link 'New Deploy Key' click_link 'New Deploy Key'
end end
...@@ -39,6 +51,10 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps ...@@ -39,6 +51,10 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
create(:deploy_keys_project, project: @second_project) create(:deploy_keys_project, project: @second_project)
end end
step 'public deploy key exists' do
create(:deploy_key, public: true)
end
step 'I click attach deploy key' do step 'I click attach deploy key' do
within '.available-keys' do within '.available-keys' do
click_link 'Enable' click_link 'Enable'
...@@ -50,4 +66,12 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps ...@@ -50,4 +66,12 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
def deploy_key def deploy_key
@project.deploy_keys.last @project.deploy_keys.last
end end
def other_deploy_key
@second_project.deploy_keys.last
end
def public_deploy_key
DeployKey.are_public.last
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