Commit b71d66e0da451e0823298397ef1baa80980e08e3

Authored by Daniel Alves + Diego Araújo
Committed by Paulo Meireles
1 parent 9af6e988

[Mezuro] Finished repository feature and fixed some steps.

features/step_definitions/mezuro_steps.rb
@@ -44,7 +44,7 @@ Then /^I should see "([^\"]*)" inside an alert$/ do |message| @@ -44,7 +44,7 @@ Then /^I should see "([^\"]*)" inside an alert$/ do |message|
44 alert.accept 44 alert.accept
45 end 45 end
46 46
47 -Then /^I should see "([^"]*)" in the "([^"]*)" input$/ do |content, labeltext| 47 +Then /^I should see "([^"]*)" in the "([^"]*)"$/ do |content, labeltext|
48 find_field(labeltext).value.should == content 48 find_field(labeltext).value.should == content
49 end 49 end
50 50
@@ -56,10 +56,6 @@ Then /^I should see "([^"]*)" in a link$/ do |link_name| @@ -56,10 +56,6 @@ Then /^I should see "([^"]*)" in a link$/ do |link_name|
56 find_link(link_name).should_not be_nil 56 find_link(link_name).should_not be_nil
57 end 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 should see "([^"]*)" in the process period select field$/ do |content| 59 Then /^I should see "([^"]*)" in the process period select field$/ do |content|
64 selected = MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options.select { |option| option.first == content }.first 60 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 61 assert_equal selected.last, find_field("repository_process_period").value.to_i
plugins/mezuro/features/configuration.feature
@@ -80,8 +80,8 @@ Feature: Configuration @@ -80,8 +80,8 @@ Feature: Configuration
80 | user | joaosilva | 80 | user | joaosilva |
81 And I am on article "Sample Configuration" 81 And I am on article "Sample Configuration"
82 When I follow "Edit" 82 When I follow "Edit"
83 - Then I should see "Sample Configuration" in the "article_name" input  
84 - And I should see "Sample Description" in the "article_description" input 83 + Then I should see "Sample Configuration" in the "article_name"
  84 + And I should see "Sample Description" in the "article_description"
85 And I should see "Save" button 85 And I should see "Save" button
86 86
87 @selenium @kalibro_restart 87 @selenium @kalibro_restart
plugins/mezuro/features/project.feature
@@ -56,8 +56,8 @@ Feature: Project @@ -56,8 +56,8 @@ Feature: Project
56 | community | mycommunity | 56 | community | mycommunity |
57 And I am on article "Sample Project" 57 And I am on article "Sample Project"
58 When I follow "Edit" 58 When I follow "Edit"
59 - Then I should see "Sample Project" in the "article_name" input  
60 - And I should see "Sample Description" in the "article_description" input 59 + Then I should see "Sample Project" in the "article_name"
  60 + And I should see "Sample Description" in the "article_description"
61 And I should see "Save" button 61 And I should see "Save" button
62 62
63 @selenium @kalibro_restart 63 @selenium @kalibro_restart
plugins/mezuro/features/reading.feature
@@ -120,9 +120,9 @@ Feature: Reading @@ -120,9 +120,9 @@ Feature: Reading
120 | color | 34afe2 | 120 | color | 34afe2 |
121 And I am on article "Sample Reading Group" 121 And I am on article "Sample Reading Group"
122 When I follow the edit link for "Simple" reading 122 When I follow the edit link for "Simple" reading
123 - Then I should see "Simple" in the "reading_label" input  
124 - And I should see "2.0" in the "reading_grade" input  
125 - And I should see "34afe2" in the "reading_color" input 123 + Then I should see "Simple" in the "reading_label"
  124 + And I should see "2.0" in the "reading_grade"
  125 + And I should see "34afe2" in the "reading_color"
126 And I should see "Save" button 126 And I should see "Save" button
127 127
128 @selenium 128 @selenium
plugins/mezuro/features/reading_group.feature
@@ -53,8 +53,8 @@ Feature: Reading Group @@ -53,8 +53,8 @@ Feature: Reading Group
53 | user | joaosilva | 53 | user | joaosilva |
54 And I am on article "Sample Reading group" 54 And I am on article "Sample Reading group"
55 When I follow "Edit" 55 When I follow "Edit"
56 - Then I should see "Sample Reading group" in the "article_name" input  
57 - And I should see "Sample Description" in the "article_description" input 56 + Then I should see "Sample Reading group" in the "article_name"
  57 + And I should see "Sample Description" in the "article_description"
58 And I should see "Save" button 58 And I should see "Save" button
59 59
60 @selenium @kalibro_restart 60 @selenium @kalibro_restart
plugins/mezuro/features/repository.feature
@@ -70,7 +70,7 @@ Feature: Repository @@ -70,7 +70,7 @@ Feature: Repository
70 Then I should see "Please fill all fields marked with (*)." inside an alert 70 Then I should see "Please fill all fields marked with (*)." inside an alert
71 71
72 @selenium 72 @selenium
73 - Scenario: I try to add a repository with a invalid address 73 + Scenario: I try to add a repository with an invalid address
74 Given I am on article "Sample Project" 74 Given I am on article "Sample Project"
75 And I follow "Add Repository" 75 And I follow "Add Repository"
76 When I fill the fields with the new following data 76 When I fill the fields with the new following data
@@ -106,7 +106,6 @@ Feature: Repository @@ -106,7 +106,6 @@ Feature: Repository
106 And I should see "Sample Configuration" 106 And I should see "Sample Configuration"
107 And I should see "Status" 107 And I should see "Status"
108 108
109 - #FIXME: Check the new rule "I have a Mezuro repository"  
110 @selenium 109 @selenium
111 Scenario: I want to see the repository edit form 110 Scenario: I want to see the repository edit form
112 Given I have a Mezuro repository with the following data 111 Given I have a Mezuro repository with the following data
@@ -118,30 +117,27 @@ Feature: Repository @@ -118,30 +117,27 @@ Feature: Repository
118 | address | https://github.com/user/project.git | 117 | address | https://github.com/user/project.git |
119 | configuration_id | Sample Configuration | 118 | configuration_id | Sample Configuration |
120 And I am on article "Sample Project" 119 And I am on article "Sample Project"
121 - When I follow "Edit"  
122 - Then I should see "My Name" in the "repository_name" input  
123 - And I should see "My Description" in the "repository_description" input  
124 - And I should see "ISC License (ISC)" in the "repository_license" select 120 + When I follow the edit link for "My Name" repository
  121 + Then I should see "My Name" in the "repository_name"
  122 + And I should see "My Description" in the "repository_description"
  123 + And I should see "ISC License (ISC)" in the "repository_license"
125 And I should see "Not Periodically" in the process period select field 124 And I should see "Not Periodically" in the process period select field
126 - And I should see "GIT" in the "repository_type" select  
127 - And I should see "https://github.com/user/project.git" in the "repository_address" input 125 + And I should see "GIT" in the "repository_type"
  126 + And I should see "https://github.com/user/project.git" in the "repository_address"
128 And I should see "Sample Configuration" in the repository configuration select field 127 And I should see "Sample Configuration" in the repository configuration select field
129 128
130 - #FIXME: Check the new rule "I have a Mezuro repository"  
131 @selenium 129 @selenium
132 Scenario: I edit a Mezuro repository with valid attributes 130 Scenario: I edit a Mezuro repository with valid attributes
133 - Given I follow "Add Repository"  
134 - And I fill the fields with the new following data  
135 - | repository_name | My Name |  
136 - | repository_description | My Description |  
137 - | repository_license | ISC License (ISC) |  
138 - | repository_process_period | Not Periodically |  
139 - | repository_type | GIT |  
140 - | repository_address | https://github.com/user/project.git |  
141 - | repository_configuration_id | Sample Configuration |  
142 - And I press "Add" 131 + Given I have a Mezuro repository with the following data
  132 + | name | My Name |
  133 + | description | My Description |
  134 + | license | ISC License (ISC) |
  135 + | process_period | Not Periodically |
  136 + | type | GIT |
  137 + | address | https://github.com/user/project.git |
  138 + | configuration_id | Sample Configuration |
143 And I am on article "Sample Project" 139 And I am on article "Sample Project"
144 - When I follow "Edit" 140 + When I follow the edit link for "My Name" repository
145 And I fill the fields with the new following data 141 And I fill the fields with the new following data
146 | repository_name | Another Name | 142 | repository_name | Another Name |
147 | repository_description | Another Description | 143 | repository_description | Another Description |
@@ -151,7 +147,7 @@ Feature: Repository @@ -151,7 +147,7 @@ Feature: Repository
151 | repository_address | https://project.svn.sourceforge.net/svnroot/project | 147 | repository_address | https://project.svn.sourceforge.net/svnroot/project |
152 | repository_configuration_id | Sample Configuration | 148 | repository_configuration_id | Sample Configuration |
153 And I press "Add" 149 And I press "Add"
154 - Then I should see "Another Name" 150 + Then I should see "Another Name"
155 And I should see "Another Description" 151 And I should see "Another Description"
156 And I should see "Apple Public Source License (APSL-2.0)" 152 And I should see "Apple Public Source License (APSL-2.0)"
157 And I should see "Weekly" 153 And I should see "Weekly"
@@ -159,68 +155,79 @@ Feature: Repository @@ -159,68 +155,79 @@ Feature: Repository
159 And I should see "https://project.svn.sourceforge.net/svnroot/project" 155 And I should see "https://project.svn.sourceforge.net/svnroot/project"
160 And I should see "Sample Configuration" 156 And I should see "Sample Configuration"
161 157
162 - #FIXME: Check the new rule "I have a Mezuro repository"  
163 @selenium 158 @selenium
164 Scenario: I try to edit a Mezuro repository leaving empty its title 159 Scenario: I try to edit a Mezuro repository leaving empty its title
165 - Given I follow "Add Repository"  
166 - And I fill the fields with the new following data  
167 - | repository_name | My Name |  
168 - | repository_description | My Description |  
169 - | repository_license | ISC License (ISC) |  
170 - | repository_process_period | Not Periodically |  
171 - | repository_type | GIT |  
172 - | repository_address | https://github.com/user/project.git |  
173 - | repository_configuration_id | Sample Configuration |  
174 - And I press "Add"  
175 - And I am on article "Sample Project"  
176 - And I follow "Edit" 160 + Given I have a Mezuro repository with the following data
  161 + | name | My Name |
  162 + | description | My Description |
  163 + | license | ISC License (ISC) |
  164 + | process_period | Not Periodically |
  165 + | type | GIT |
  166 + | address | https://github.com/user/project.git |
  167 + | configuration_id | Sample Configuration |
  168 + And I am on article "Sample Project"
  169 + And I follow the edit link for "My Name" repository
177 When I erase the "repository_name" field 170 When I erase the "repository_name" field
178 And I press "Add" 171 And I press "Add"
179 Then I should see "Please fill all fields marked with (*)." inside an alert 172 Then I should see "Please fill all fields marked with (*)." inside an alert
180 173
181 - #FIXME: Check the new rule "I have a Mezuro repository"  
182 @selenium 174 @selenium
183 Scenario: I try to edit a Mezuro repository leaving empty its address 175 Scenario: I try to edit a Mezuro repository leaving empty its address
184 - Given I follow "Add Repository"  
185 - And I fill the fields with the new following data  
186 - | repository_name | My Name |  
187 - | repository_description | My Description |  
188 - | repository_license | ISC License (ISC) |  
189 - | repository_process_period | Not Periodically |  
190 - | repository_type | GIT |  
191 - | repository_address | https://github.com/user/project.git |  
192 - | repository_configuration_id | Sample Configuration |  
193 - And I press "Add"  
194 - And I am on article "Sample Project"  
195 - And I follow "Edit" 176 + Given I have a Mezuro repository with the following data
  177 + | name | My Name |
  178 + | description | My Description |
  179 + | license | ISC License (ISC) |
  180 + | process_period | Not Periodically |
  181 + | type | GIT |
  182 + | address | https://github.com/user/project.git |
  183 + | configuration_id | Sample Configuration |
  184 + And I am on article "Sample Project"
  185 + And I follow the edit link for "My Name" repository
196 When I erase the "repository_address" field 186 When I erase the "repository_address" field
197 And I press "Add" 187 And I press "Add"
198 Then I should see "Please fill all fields marked with (*)." inside an alert 188 Then I should see "Please fill all fields marked with (*)." inside an alert
199 189
200 - #FIXME: Check the new rule "I have a Mezuro repository"  
201 @selenium 190 @selenium
202 - Scenario: I try to edit a repository with an existing repository name  
203 - Given I follow "Add Repository"  
204 - And I fill the fields with the new following data  
205 - | repository_name | My Name |  
206 - | repository_description | My Description |  
207 - | repository_license | ISC License (ISC) |  
208 - | repository_process_period | Not Periodically |  
209 - | repository_type | GIT |  
210 - | repository_address | https://github.com/user/project.git |  
211 - | repository_configuration_id | Sample Configuration |  
212 - And I press "Add" 191 + Scenario: I try to edit a Mezuro repository with an invalid address
  192 + Given I have a Mezuro repository with the following data
  193 + | name | My Name |
  194 + | description | My Description |
  195 + | license | ISC License (ISC) |
  196 + | process_period | Not Periodically |
  197 + | type | GIT |
  198 + | address | https://github.com/user/project.git |
  199 + | configuration_id | Sample Configuration |
213 And I am on article "Sample Project" 200 And I am on article "Sample Project"
214 - And I follow "Add Repository" 201 + When I follow the edit link for "My Name" repository
215 And I fill the fields with the new following data 202 And I fill the fields with the new following data
216 | repository_name | Another Name | 203 | repository_name | Another Name |
217 | repository_description | Another Description | 204 | repository_description | Another Description |
218 | repository_license | Apple Public Source License (APSL-2.0) | 205 | repository_license | Apple Public Source License (APSL-2.0) |
219 | repository_process_period | Weekly | 206 | repository_process_period | Weekly |
220 | repository_type | SUBVERSION | 207 | repository_type | SUBVERSION |
221 - | repository_address | https://project.svn.sourceforge.net/svnroot/project | 208 + | repository_address | https://invalid-address.any-extension |
222 | repository_configuration_id | Sample Configuration | 209 | repository_configuration_id | Sample Configuration |
223 And I press "Add" 210 And I press "Add"
  211 + Then I should see "Address does not match type SUBVERSION chosen." inside an alert
  212 +
  213 + @selenium
  214 + Scenario: I try to edit a repository with an existing repository name
  215 + Given I have a Mezuro repository with the following data
  216 + | name | My Name |
  217 + | description | My Description |
  218 + | license | ISC License (ISC) |
  219 + | process_period | Not Periodically |
  220 + | type | GIT |
  221 + | address | https://github.com/user/project.git |
  222 + | configuration_id | Sample Configuration |
  223 + And I have a Mezuro repository with the following data
  224 + | name | Another Name |
  225 + | description | Another Description |
  226 + | license | Apple Public Source License (APSL-2.0) |
  227 + | process_period | Weekly |
  228 + | type | SUBVERSION |
  229 + | address | https://project.svn.sourceforge.net/svnroot/project |
  230 + | configuration_id | Sample Configuration |
224 And I am on article "Sample Project" 231 And I am on article "Sample Project"
225 When I follow the edit link for "My Name" repository 232 When I follow the edit link for "My Name" repository
226 And I fill the fields with the new following data 233 And I fill the fields with the new following data
@@ -235,19 +242,35 @@ Feature: Repository @@ -235,19 +242,35 @@ Feature: Repository
235 #Then I should see "Slug The title (article name) is already being used by another article, please use another title." 242 #Then I should see "Slug The title (article name) is already being used by another article, please use another title."
236 #FIXME fix this validation 243 #FIXME fix this validation
237 244
238 - #FIXME: Need to define permissions?  
239 @selenium 245 @selenium
240 - Scenario: I delete a Mezuro repository  
241 - Given I follow "Add Repository"  
242 - And I fill the fields with the new following data  
243 - | repository_name | My Name |  
244 - | repository_description | My Description |  
245 - | repository_license | ISC License (ISC) |  
246 - | repository_process_period | Not Periodically |  
247 - | repository_type | GIT |  
248 - | repository_address | https://github.com/user/project.git |  
249 - | repository_configuration_id | Sample Configuration |  
250 - And I press "Add" 246 + Scenario: I delete a Mezuro repository of mine
  247 + Given I have a Mezuro repository with the following data
  248 + | name | My Name |
  249 + | description | My Description |
  250 + | license | ISC License (ISC) |
  251 + | process_period | Not Periodically |
  252 + | type | GIT |
  253 + | address | https://github.com/user/project.git |
  254 + | configuration_id | Sample Configuration |
251 And I am on article "Sample Project" 255 And I am on article "Sample Project"
252 When I follow the remove link for "My Name" repository 256 When I follow the remove link for "My Name" repository
253 Then I should not see "My Name" 257 Then I should not see "My Name"
  258 +
  259 + @selenium
  260 + Scenario: I try to edit or delete a Mezuro repository which doesn't belong to me
  261 + Given I have a Mezuro repository with the following data
  262 + | name | My Name |
  263 + | description | My Description |
  264 + | license | ISC License (ISC) |
  265 + | process_period | Not Periodically |
  266 + | type | GIT |
  267 + | address | https://github.com/user/project.git |
  268 + | configuration_id | Sample Configuration |
  269 + And the following users
  270 + | login | name |
  271 + | zacarias | Zacarias |
  272 + And I am logged in as "zacarias"
  273 + When I am on article "Sample Project"
  274 + Then I should not see the edit link for "My Name" repository
  275 + And I should not see the remove link for "My Name" repository
  276 +
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
@@ -16,7 +16,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper @@ -16,7 +16,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper
16 16
17 def self.license_options 17 def self.license_options
18 options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yml") 18 options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yml")
19 - options = options.split(";") 19 + options = options.split("; ")
20 options 20 options
21 end 21 end
22 22
plugins/mezuro/licenses.yml.example
@@ -66,4 +66,4 @@ W3C License (W3C); @@ -66,4 +66,4 @@ W3C License (W3C);
66 wxWindows Library License (WXwindows); 66 wxWindows Library License (WXwindows);
67 X.Net License (Xnet); 67 X.Net License (Xnet);
68 Zope Public License 2.0 (ZPL-2.0); 68 Zope Public License 2.0 (ZPL-2.0);
69 -zlib/libpng license (Zlib); 69 +zlib/libpng license (Zlib)