From d7f96bdf91de4745636886d004b9e5981c5f92d4 Mon Sep 17 00:00:00 2001 From: Rafael Reggiani Manzo Date: Sat, 26 Oct 2013 16:33:29 -0200 Subject: [PATCH] Repository creation validations acceptance tests --- features/repository/create.feature | 64 ++++++++++++++++++++++++++++++++++++++++++++++------------------ features/step_definitions/project_steps.rb | 1 + features/step_definitions/repository_steps.rb | 4 ++++ 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/features/repository/create.feature b/features/repository/create.feature index 14075cc..1ad39c8 100644 --- a/features/repository/create.feature +++ b/features/repository/create.feature @@ -1,22 +1,50 @@ Feature: Repository Creation - In order to register my repositories - As a regular user - I should be able to create repositories + In order to register my repositories + As a regular user + I should be able to create repositories @kalibro_restart Scenario: repository creation - Given I am a regular user - And I am signed in - And I own a sample project - And I have a sample configuration with native metrics - And I am at the New Repository page - And I fill the Name field with "Kalibro" - And I set the select field Type as "GIT" - And I fill the Address field with "https://github.com/mezuro/kalibro_entities.git" - And I set the select field Configuration as the sample configuration - When I press the Save button - Then I should be in the Sample Project page - And I should not see There are no repositories yet! - And I should see "Kalibro" - And I should see "GIT" - And I should see "https://github.com/mezuro/kalibro_entities.git" + Given I am a regular user + And I am signed in + And I own a sample project + And I have a sample configuration with native metrics + And I am at the New Repository page + And I fill the Name field with "Kalibro" + And I set the select field Type as "GIT" + And I fill the Address field with "https://github.com/mezuro/kalibro_entities.git" + And I set the select field Configuration as the sample configuration + When I press the Save button + Then I should be in the Sample Project page + And I should not see There are no repositories yet! + And I should see "Kalibro" + And I should see "GIT" + And I should see "https://github.com/mezuro/kalibro_entities.git" + +@kalibro_restart +Scenario: repository creation blank validations + Given I am a regular user + And I am signed in + And I own a sample project + And I have a sample configuration with native metrics + And I am at the New Repository page + And I set the select field Type as "GIT" + And I set the select field Configuration as the sample configuration + When I press the Save button + Then I should see "Name can't be blank" + And I should see "Address can't be blank" + +@kalibro_restart +Scenario: repository creation with name already taken + Given I am a regular user + And I am signed in + And I own a sample project + And I have a sample configuration with native metrics + And I have a sample repository within the sample project named "KalibroEntities" + And I am at the New Repository page + And I fill the Name field with "KalibroEntities" + And I set the select field Type as "GIT" + And I fill the Address field with "https://github.com/mezuro/kalibro_entities.git" + And I set the select field Configuration as the sample configuration + When I press the Save button + Then I should see "There's already" \ No newline at end of file diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index 663178e..3fdf596 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -42,6 +42,7 @@ Then(/^I should not see (.+)$/) do |text| page.should_not have_content(text) end +#FIXME: this is step is not matched Then(/^I should not see "(.+)"" within "(.+)"$/) do |text, selector| page.find(selector).should_not have_content(text) end diff --git a/features/step_definitions/repository_steps.rb b/features/step_definitions/repository_steps.rb index fd54531..95b2f58 100644 --- a/features/step_definitions/repository_steps.rb +++ b/features/step_definitions/repository_steps.rb @@ -11,6 +11,10 @@ Given(/^I have a sample repository within the sample project$/) do @repository = FactoryGirl.create(:repository, {project_id: @project.id, configuration_id: @configuration.id, id: nil}) end +Given(/^I have a sample repository within the sample project named "(.+)"$/) do |name| + @repository = FactoryGirl.create(:repository, {project_id: @project.id, configuration_id: @configuration.id, id: nil, name: name}) +end + Given(/^I start to process that repository$/) do @repository.process end -- libgit2 0.21.2