Commit 94993587d15ba49f2a5ddbab51b3d632fdc14c0b

Authored by Daniel Alves + Diego Araújo + Guilherme Rojas
Committed by Paulo Meireles
1 parent 44e8c85f

[Mezuro] More acceptance tests on repository.feature. Still working on it.

features/step_definitions/mezuro_steps.rb
@@ -43,7 +43,7 @@ Then /^I should not see "([^"]*)" button$/ do |button_name| @@ -43,7 +43,7 @@ Then /^I should not see "([^"]*)" button$/ do |button_name|
43 find_button(button_name).should be_nil 43 find_button(button_name).should be_nil
44 end 44 end
45 45
46 -When /^I have a Mezuro (project|reading group) with the following data$/ do |type,fields| 46 +When /^I have a Mezuro (project|reading group|configuration) with the following data$/ do |type,fields|
47 item = {} 47 item = {}
48 fields.rows_hash.each do |name, value| 48 fields.rows_hash.each do |name, value|
49 if(name=="user" or name=="community") 49 if(name=="user" or name=="community")
@@ -52,22 +52,16 @@ When /^I have a Mezuro (project|reading group) with the following data$/ do |typ @@ -52,22 +52,16 @@ When /^I have a Mezuro (project|reading group) with the following data$/ do |typ
52 item.merge!(name => value) 52 item.merge!(name => value)
53 end 53 end
54 end 54 end
55 - if(type=="project") 55 + if (type == "project")
56 result = MezuroPlugin::ProjectContent.new(item) 56 result = MezuroPlugin::ProjectContent.new(item)
57 - elsif(type=="reading group") 57 + elsif (type == "reading group")
58 result = MezuroPlugin::ReadingGroupContent.new(item) 58 result = MezuroPlugin::ReadingGroupContent.new(item)
  59 + elsif (type == "configuration")
  60 + result = MezuroPlugin::ConfigurationContent.new(item)
59 end 61 end
60 result.save! 62 result.save!
61 end 63 end
62 64
63 -When /^I have a configuration with the following data$/ do |fields|  
64 - attributes = {}  
65 - fields.rows_hash.each do |name, value|  
66 - attributes.merge!(name => value)  
67 - end  
68 - Kalibro::Configuration.create(attributes)  
69 -end  
70 -  
71 When /^I erase the "([^"]*)" field$/ do |field_name| 65 When /^I erase the "([^"]*)" field$/ do |field_name|
72 find_field(field_name).set "" 66 find_field(field_name).set ""
73 end 67 end
plugins/mezuro/features/repository.feature
@@ -30,19 +30,48 @@ Feature: Repository @@ -30,19 +30,48 @@ Feature: Repository
30 And I should see "Configuration" 30 And I should see "Configuration"
31 And I should see "Add" button 31 And I should see "Add" button
32 32
33 - @selenium  
34 Scenario: I want to add a repository with no name 33 Scenario: I want to add a repository with no name
  34 + And I have a Mezuro configuration with the following data
  35 + | name | Sample Configuration|
  36 + | description | Sample Description |
  37 + | user | joaosilva |
35 Given I follow "Add Repository" 38 Given I follow "Add Repository"
36 - When I fill the fields with the following data  
37 - | repository_name | | 39 + When I fill the fields with the new following data
  40 + | repository_name | |
38 | repository_description | My Description | 41 | repository_description | My Description |
39 | repository_license | ISC License (ISC) | 42 | repository_license | ISC License (ISC) |
40 | repository_process_period | Not Periodically | 43 | repository_process_period | Not Periodically |
41 | repository_type | SUBVERSION | 44 | repository_type | SUBVERSION |
42 | repository_address | https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator | 45 | repository_address | https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator |
43 - | repository_configuration_id | 1 | 46 + | repository_configuration_id | Sample Configuration |
44 And I press "Add" 47 And I press "Add"
45 Then I should see "Please fill all fields marked with (*)." inside an alert 48 Then I should see "Please fill all fields marked with (*)." inside an alert
46 49
  50 + Scenario: I want to add a repository with no address
  51 + Given I follow "Add Repository"
  52 + When I fill the fields with the new following data
  53 + | repository_name | My Name |
  54 + | repository_description | My Description |
  55 + | repository_license | ISC License (ISC) |
  56 + | repository_process_period | Not Periodically |
  57 + | repository_type | SUBVERSION |
  58 + | repository_address | |
  59 + | repository_configuration_id | Sample Configuration |
  60 + And I press "Add"
  61 + Then I should see "Please fill all fields marked with (*)." inside an alert
  62 +
  63 + Scenario: I want to add a repository with a invalid address for git repository
  64 + Given I follow "Add Repository"
  65 + When I fill the fields with the new following data
  66 + | repository_name | My Name |
  67 + | repository_description | My Description |
  68 + | repository_license | ISC License (ISC) |
  69 + | repository_process_period | Not Periodically |
  70 + | repository_type | GIT |
  71 + | repository_address | https://invalid-address.any-extension |
  72 + | repository_configuration_id | Sample Configuration |
  73 + And I press "Add"
  74 + Then I should see "Address does not match type GIT chosen." inside an alert
  75 +
47 #Scenario: I want to add a repository with valid attributes 76 #Scenario: I want to add a repository with valid attributes
48 77