Commit b6af682e01f2d06f67d0aa16d30d9373690388cc

Authored by Daniel Alves + Guilherme Rojas
Committed by Paulo Meireles
1 parent 3835f7f6

[Mezuro] Working on Repository Feature.

features/step_definitions/mezuro_steps.rb
... ... @@ -56,11 +56,20 @@ Then /^I should see "([^"]*)" in a link$/ do |link_name|
56 56 find_link(link_name).should_not be_nil
57 57 end
58 58  
  59 +Then /^I should see "([^"]*)" in the "([^"]*)" select$/ do |content, labeltext|
  60 + find_field(labeltext).value.strip.should == content #strip because have empty spaces around some options
  61 +end
  62 +
  63 +Then /^I shoud see "([^"]*)" in the process period select field$/ do |content|
  64 + selected = MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options.select { |option| option.first == content }.first
  65 + assert_equal selected.last, find_field("repository_process_period").value.to_i
  66 +end
  67 +
59 68 Then /^I should not see "([^"]*)" button$/ do |button_name|
60 69 find_button(button_name).should be_nil
61 70 end
62 71  
63   -When /^I have a Mezuro (project|reading group|configuration) with the following data$/ do |type,fields|
  72 +When /^I have a Mezuro (project|reading group|configuration|repository) with the following data$/ do |type,fields|
64 73 item = {}
65 74 fields.rows_hash.each do |name, value|
66 75 if(name=="user" or name=="community")
... ... @@ -76,7 +85,16 @@ When /^I have a Mezuro (project|reading group|configuration) with the following
76 85 elsif (type == "configuration")
77 86 result = MezuroPlugin::ConfigurationContent.new(item)
78 87 end
79   - result.save!
  88 +
  89 + if (type == "repository")
  90 + puts Kalibro::Configuration.all.last.id
  91 + puts Kalibro::Project.all.last.id
  92 + item.merge(:configuration_id => Kalibro::Configuration.all.last.id)
  93 + result = Kalibro::Repository.new(item)
  94 + raise (result.save Kalibro::Project.all.last.id).inspect
  95 + else
  96 + result.save!
  97 + end
80 98 end
81 99  
82 100 When /^I erase the "([^"]*)" field$/ do |field_name|
... ...
plugins/mezuro/features/repository.feature
... ... @@ -40,7 +40,7 @@ Feature: Repository
40 40 And I should see "Add" button
41 41  
42 42 @selenium
43   - Scenario: I want to add a repository with no name
  43 + Scenario: I try to add a repository with no name
44 44 Given I follow "Add Repository"
45 45 When I fill the fields with the new following data
46 46 | repository_name | |
... ... @@ -54,7 +54,7 @@ Feature: Repository
54 54 Then I should see "Please fill all fields marked with (*)." inside an alert
55 55  
56 56 @selenium
57   - Scenario: I want to add a repository with no address
  57 + Scenario: I try to add a repository with no address
58 58 Given I follow "Add Repository"
59 59 When I fill the fields with the new following data
60 60 | repository_name | My Name |
... ... @@ -68,7 +68,7 @@ Feature: Repository
68 68 Then I should see "Please fill all fields marked with (*)." inside an alert
69 69  
70 70 @selenium
71   - Scenario: I want to add a repository with a invalid address
  71 + Scenario: I try to add a repository with a invalid address
72 72 Given I follow "Add Repository"
73 73 When I fill the fields with the new following data
74 74 | repository_name | My Name |
... ... @@ -101,5 +101,87 @@ Feature: Repository
101 101 And I should see "https://github.com/user/project.git"
102 102 And I should see "Sample Configuration"
103 103  
104   - #Scenario: I want to see the repository edit form
105   - # Given I have a repository with the following data
106 104 \ No newline at end of file
  105 + #FIXME: create the step given I have repository...
  106 + @selenium
  107 + Scenario: I want to see the repository edit form
  108 + Given I follow "Add Repository"
  109 + And I fill the fields with the new following data
  110 + | repository_name | My Name |
  111 + | repository_description | My Description |
  112 + | repository_license | ISC License (ISC) |
  113 + | repository_process_period | Not Periodically |
  114 + | repository_type | GIT |
  115 + | repository_address | https://github.com/user/project.git |
  116 + | repository_configuration_id | Sample Configuration |
  117 + And I press "Add"
  118 + And I am on article "Sample Project"
  119 + When I follow "Edit"
  120 + Then I should see "My Name" in the "repository_name" input
  121 + And I should see "My Description" in the "repository_description" input
  122 + And I should see "ISC License (ISC)" in the "repository_license" select
  123 + And I should see "Not Periodically" in the process period select field
  124 + And I should see "GIT" in the "repository_type" select
  125 + And I should see "https://github.com/user/project.git" in the "repository_address" input
  126 + And I should see "Sample Configuration" in the "repository_configuration_id" select
  127 +
  128 + #FIXME: create the step given I have repository...
  129 + @selenium
  130 + Scenario: I want to see the repository edit form
  131 + Given I follow "Add Repository"
  132 + And I fill the fields with the new following data
  133 + | repository_name | My Name |
  134 + | repository_description | My Description |
  135 + | repository_license | ISC License (ISC) |
  136 + | repository_process_period | Not Periodically |
  137 + | repository_type | GIT |
  138 + | repository_address | https://github.com/user/project.git |
  139 + | repository_configuration_id | Sample Configuration |
  140 + And I press "Add"
  141 + And I am on article "Sample Project"
  142 + When I follow "Edit"
  143 + Then I should see "My Name" in the "repository_name" input
  144 + And I should see "My Description" in the "repository_description" input
  145 + And I should see "ISC License (ISC)" in the "repository_license" select
  146 + And I should see "Not Periodically" in the process period select field
  147 + And I should see "GIT" in the "repository_type" select
  148 + And I should see "https://github.com/user/project.git" in the "repository_address" input
  149 + And I should see "2" in the "repository_configuration_id" select
  150 +
  151 + #FIXME: create the step given I have repository...
  152 + @selenium
  153 + Scenario: I try to edit a Mezuro project leaving empty its title
  154 + Given I follow "Add Repository"
  155 + And I fill the fields with the new following data
  156 + | repository_name | My Name |
  157 + | repository_description | My Description |
  158 + | repository_license | ISC License (ISC) |
  159 + | repository_process_period | Not Periodically |
  160 + | repository_type | GIT |
  161 + | repository_address | https://github.com/user/project.git |
  162 + | repository_configuration_id | Sample Configuration |
  163 + And I press "Add"
  164 + And I am on article "Sample Project"
  165 + And I follow "Edit"
  166 + When I erase the "repository_name" field
  167 + And I press "Add"
  168 + Then I should see "Please fill all fields marked with (*)." inside an alert
  169 +
  170 + #FIXME: create the step given I have repository...
  171 + @selenium
  172 + Scenario: I try to edit a Mezuro project leaving empty its address
  173 + Given I follow "Add Repository"
  174 + And I fill the fields with the new following data
  175 + | repository_name | My Name |
  176 + | repository_description | My Description |
  177 + | repository_license | ISC License (ISC) |
  178 + | repository_process_period | Not Periodically |
  179 + | repository_type | GIT |
  180 + | repository_address | https://github.com/user/project.git |
  181 + | repository_configuration_id | Sample Configuration |
  182 + And I press "Add"
  183 + And I am on article "Sample Project"
  184 + And I follow "Edit"
  185 + When I erase the "repository_address" field
  186 + And I press "Add"
  187 + Then I should see "Please fill all fields marked with (*)." inside an alert
  188 +
... ...