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 44 alert.accept
45 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 48 find_field(labeltext).value.should == content
49 49 end
50 50  
... ... @@ -56,10 +56,6 @@ 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 59 Then /^I should see "([^"]*)" in the process period select field$/ do |content|
64 60 selected = MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options.select { |option| option.first == content }.first
65 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 80 | user | joaosilva |
81 81 And I am on article "Sample Configuration"
82 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 85 And I should see "Save" button
86 86  
87 87 @selenium @kalibro_restart
... ...
plugins/mezuro/features/project.feature
... ... @@ -56,8 +56,8 @@ Feature: Project
56 56 | community | mycommunity |
57 57 And I am on article "Sample Project"
58 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 61 And I should see "Save" button
62 62  
63 63 @selenium @kalibro_restart
... ...
plugins/mezuro/features/reading.feature
... ... @@ -120,9 +120,9 @@ Feature: Reading
120 120 | color | 34afe2 |
121 121 And I am on article "Sample Reading Group"
122 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 126 And I should see "Save" button
127 127  
128 128 @selenium
... ...
plugins/mezuro/features/reading_group.feature
... ... @@ -53,8 +53,8 @@ Feature: Reading Group
53 53 | user | joaosilva |
54 54 And I am on article "Sample Reading group"
55 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 58 And I should see "Save" button
59 59  
60 60 @selenium @kalibro_restart
... ...
plugins/mezuro/features/repository.feature
... ... @@ -70,7 +70,7 @@ Feature: Repository
70 70 Then I should see "Please fill all fields marked with (*)." inside an alert
71 71  
72 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 74 Given I am on article "Sample Project"
75 75 And I follow "Add Repository"
76 76 When I fill the fields with the new following data
... ... @@ -106,7 +106,6 @@ Feature: Repository
106 106 And I should see "Sample Configuration"
107 107 And I should see "Status"
108 108  
109   - #FIXME: Check the new rule "I have a Mezuro repository"
110 109 @selenium
111 110 Scenario: I want to see the repository edit form
112 111 Given I have a Mezuro repository with the following data
... ... @@ -118,30 +117,27 @@ Feature: Repository
118 117 | address | https://github.com/user/project.git |
119 118 | configuration_id | Sample Configuration |
120 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 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 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 129 @selenium
132 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 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 141 And I fill the fields with the new following data
146 142 | repository_name | Another Name |
147 143 | repository_description | Another Description |
... ... @@ -151,7 +147,7 @@ Feature: Repository
151 147 | repository_address | https://project.svn.sourceforge.net/svnroot/project |
152 148 | repository_configuration_id | Sample Configuration |
153 149 And I press "Add"
154   - Then I should see "Another Name"
  150 + Then I should see "Another Name"
155 151 And I should see "Another Description"
156 152 And I should see "Apple Public Source License (APSL-2.0)"
157 153 And I should see "Weekly"
... ... @@ -159,68 +155,79 @@ Feature: Repository
159 155 And I should see "https://project.svn.sourceforge.net/svnroot/project"
160 156 And I should see "Sample Configuration"
161 157  
162   - #FIXME: Check the new rule "I have a Mezuro repository"
163 158 @selenium
164 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 170 When I erase the "repository_name" field
178 171 And I press "Add"
179 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 174 @selenium
183 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 186 When I erase the "repository_address" field
197 187 And I press "Add"
198 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 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 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 202 And I fill the fields with the new following data
216 203 | repository_name | Another Name |
217 204 | repository_description | Another Description |
218 205 | repository_license | Apple Public Source License (APSL-2.0) |
219 206 | repository_process_period | Weekly |
220 207 | repository_type | SUBVERSION |
221   - | repository_address | https://project.svn.sourceforge.net/svnroot/project |
  208 + | repository_address | https://invalid-address.any-extension |
222 209 | repository_configuration_id | Sample Configuration |
223 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 231 And I am on article "Sample Project"
225 232 When I follow the edit link for "My Name" repository
226 233 And I fill the fields with the new following data
... ... @@ -235,19 +242,35 @@ Feature: Repository
235 242 #Then I should see "Slug The title (article name) is already being used by another article, please use another title."
236 243 #FIXME fix this validation
237 244  
238   - #FIXME: Need to define permissions?
239 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 255 And I am on article "Sample Project"
252 256 When I follow the remove link for "My Name" repository
253 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 16  
17 17 def self.license_options
18 18 options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yml")
19   - options = options.split(";")
  19 + options = options.split("; ")
20 20 options
21 21 end
22 22  
... ...
plugins/mezuro/licenses.yml.example
... ... @@ -66,4 +66,4 @@ W3C License (W3C);
66 66 wxWindows Library License (WXwindows);
67 67 X.Net License (Xnet);
68 68 Zope Public License 2.0 (ZPL-2.0);
69   -zlib/libpng license (Zlib);
  69 +zlib/libpng license (Zlib)
... ...