Commit d7f96bdf91de4745636886d004b9e5981c5f92d4

Authored by Rafael Manzo
1 parent f93a1850

Repository creation validations acceptance tests

features/repository/create.feature
1 Feature: Repository Creation 1 Feature: Repository Creation
2 - In order to register my repositories  
3 - As a regular user  
4 - I should be able to create repositories 2 + In order to register my repositories
  3 + As a regular user
  4 + I should be able to create repositories
5 5
6 @kalibro_restart 6 @kalibro_restart
7 Scenario: repository creation 7 Scenario: repository creation
8 - Given I am a regular user  
9 - And I am signed in  
10 - And I own a sample project  
11 - And I have a sample configuration with native metrics  
12 - And I am at the New Repository page  
13 - And I fill the Name field with "Kalibro"  
14 - And I set the select field Type as "GIT"  
15 - And I fill the Address field with "https://github.com/mezuro/kalibro_entities.git"  
16 - And I set the select field Configuration as the sample configuration  
17 - When I press the Save button  
18 - Then I should be in the Sample Project page  
19 - And I should not see There are no repositories yet!  
20 - And I should see "Kalibro"  
21 - And I should see "GIT"  
22 - And I should see "https://github.com/mezuro/kalibro_entities.git" 8 + Given I am a regular user
  9 + And I am signed in
  10 + And I own a sample project
  11 + And I have a sample configuration with native metrics
  12 + And I am at the New Repository page
  13 + And I fill the Name field with "Kalibro"
  14 + And I set the select field Type as "GIT"
  15 + And I fill the Address field with "https://github.com/mezuro/kalibro_entities.git"
  16 + And I set the select field Configuration as the sample configuration
  17 + When I press the Save button
  18 + Then I should be in the Sample Project page
  19 + And I should not see There are no repositories yet!
  20 + And I should see "Kalibro"
  21 + And I should see "GIT"
  22 + And I should see "https://github.com/mezuro/kalibro_entities.git"
  23 +
  24 +@kalibro_restart
  25 +Scenario: repository creation blank validations
  26 + Given I am a regular user
  27 + And I am signed in
  28 + And I own a sample project
  29 + And I have a sample configuration with native metrics
  30 + And I am at the New Repository page
  31 + And I set the select field Type as "GIT"
  32 + And I set the select field Configuration as the sample configuration
  33 + When I press the Save button
  34 + Then I should see "Name can't be blank"
  35 + And I should see "Address can't be blank"
  36 +
  37 +@kalibro_restart
  38 +Scenario: repository creation with name already taken
  39 + Given I am a regular user
  40 + And I am signed in
  41 + And I own a sample project
  42 + And I have a sample configuration with native metrics
  43 + And I have a sample repository within the sample project named "KalibroEntities"
  44 + And I am at the New Repository page
  45 + And I fill the Name field with "KalibroEntities"
  46 + And I set the select field Type as "GIT"
  47 + And I fill the Address field with "https://github.com/mezuro/kalibro_entities.git"
  48 + And I set the select field Configuration as the sample configuration
  49 + When I press the Save button
  50 + Then I should see "There's already"
23 \ No newline at end of file 51 \ No newline at end of file
features/step_definitions/project_steps.rb
@@ -42,6 +42,7 @@ Then(/^I should not see (.+)$/) do |text| @@ -42,6 +42,7 @@ Then(/^I should not see (.+)$/) do |text|
42 page.should_not have_content(text) 42 page.should_not have_content(text)
43 end 43 end
44 44
  45 +#FIXME: this is step is not matched
45 Then(/^I should not see "(.+)"" within "(.+)"$/) do |text, selector| 46 Then(/^I should not see "(.+)"" within "(.+)"$/) do |text, selector|
46 page.find(selector).should_not have_content(text) 47 page.find(selector).should_not have_content(text)
47 end 48 end
features/step_definitions/repository_steps.rb
@@ -11,6 +11,10 @@ Given(/^I have a sample repository within the sample project$/) do @@ -11,6 +11,10 @@ Given(/^I have a sample repository within the sample project$/) do
11 @repository = FactoryGirl.create(:repository, {project_id: @project.id, configuration_id: @configuration.id, id: nil}) 11 @repository = FactoryGirl.create(:repository, {project_id: @project.id, configuration_id: @configuration.id, id: nil})
12 end 12 end
13 13
  14 +Given(/^I have a sample repository within the sample project named "(.+)"$/) do |name|
  15 + @repository = FactoryGirl.create(:repository, {project_id: @project.id, configuration_id: @configuration.id, id: nil, name: name})
  16 +end
  17 +
14 Given(/^I start to process that repository$/) do 18 Given(/^I start to process that repository$/) do
15 @repository.process 19 @repository.process
16 end 20 end