diff --git a/features/step_definitions/mezuro_steps.rb b/features/step_definitions/mezuro_steps.rb index 39c60f3..bffd099 100644 --- a/features/step_definitions/mezuro_steps.rb +++ b/features/step_definitions/mezuro_steps.rb @@ -44,7 +44,7 @@ Then /^I should see "([^\"]*)" inside an alert$/ do |message| alert.accept end -Then /^I should see "([^"]*)" in the "([^"]*)" input$/ do |content, labeltext| +Then /^I should see "([^"]*)" in the "([^"]*)"$/ do |content, labeltext| find_field(labeltext).value.should == content end @@ -56,10 +56,6 @@ Then /^I should see "([^"]*)" in a link$/ do |link_name| find_link(link_name).should_not be_nil end -Then /^I should see "([^"]*)" in the "([^"]*)" select$/ do |content, labeltext| - find_field(labeltext).value.strip.should == content #strip because have empty spaces around some options -end - Then /^I should see "([^"]*)" in the process period select field$/ do |content| selected = MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options.select { |option| option.first == content }.first assert_equal selected.last, find_field("repository_process_period").value.to_i diff --git a/plugins/mezuro/features/configuration.feature b/plugins/mezuro/features/configuration.feature index 561fdb9..e5895a5 100644 --- a/plugins/mezuro/features/configuration.feature +++ b/plugins/mezuro/features/configuration.feature @@ -80,8 +80,8 @@ Feature: Configuration | user | joaosilva | And I am on article "Sample Configuration" When I follow "Edit" - Then I should see "Sample Configuration" in the "article_name" input - And I should see "Sample Description" in the "article_description" input + Then I should see "Sample Configuration" in the "article_name" + And I should see "Sample Description" in the "article_description" And I should see "Save" button @selenium @kalibro_restart diff --git a/plugins/mezuro/features/project.feature b/plugins/mezuro/features/project.feature index d9f8190..e0c2516 100644 --- a/plugins/mezuro/features/project.feature +++ b/plugins/mezuro/features/project.feature @@ -56,8 +56,8 @@ Feature: Project | community | mycommunity | And I am on article "Sample Project" When I follow "Edit" - Then I should see "Sample Project" in the "article_name" input - And I should see "Sample Description" in the "article_description" input + Then I should see "Sample Project" in the "article_name" + And I should see "Sample Description" in the "article_description" And I should see "Save" button @selenium @kalibro_restart diff --git a/plugins/mezuro/features/reading.feature b/plugins/mezuro/features/reading.feature index c7b113e..8428edb 100644 --- a/plugins/mezuro/features/reading.feature +++ b/plugins/mezuro/features/reading.feature @@ -120,9 +120,9 @@ Feature: Reading | color | 34afe2 | And I am on article "Sample Reading Group" When I follow the edit link for "Simple" reading - Then I should see "Simple" in the "reading_label" input - And I should see "2.0" in the "reading_grade" input - And I should see "34afe2" in the "reading_color" input + Then I should see "Simple" in the "reading_label" + And I should see "2.0" in the "reading_grade" + And I should see "34afe2" in the "reading_color" And I should see "Save" button @selenium diff --git a/plugins/mezuro/features/reading_group.feature b/plugins/mezuro/features/reading_group.feature index c466a01..a0482eb 100644 --- a/plugins/mezuro/features/reading_group.feature +++ b/plugins/mezuro/features/reading_group.feature @@ -53,8 +53,8 @@ Feature: Reading Group | user | joaosilva | And I am on article "Sample Reading group" When I follow "Edit" - Then I should see "Sample Reading group" in the "article_name" input - And I should see "Sample Description" in the "article_description" input + Then I should see "Sample Reading group" in the "article_name" + And I should see "Sample Description" in the "article_description" And I should see "Save" button @selenium @kalibro_restart diff --git a/plugins/mezuro/features/repository.feature b/plugins/mezuro/features/repository.feature index d2e1d6f..520c1eb 100644 --- a/plugins/mezuro/features/repository.feature +++ b/plugins/mezuro/features/repository.feature @@ -70,7 +70,7 @@ Feature: Repository Then I should see "Please fill all fields marked with (*)." inside an alert @selenium - Scenario: I try to add a repository with a invalid address + Scenario: I try to add a repository with an invalid address Given I am on article "Sample Project" And I follow "Add Repository" When I fill the fields with the new following data @@ -106,7 +106,6 @@ Feature: Repository And I should see "Sample Configuration" And I should see "Status" - #FIXME: Check the new rule "I have a Mezuro repository" @selenium Scenario: I want to see the repository edit form Given I have a Mezuro repository with the following data @@ -118,30 +117,27 @@ Feature: Repository | address | https://github.com/user/project.git | | configuration_id | Sample Configuration | And I am on article "Sample Project" - When I follow "Edit" - Then I should see "My Name" in the "repository_name" input - And I should see "My Description" in the "repository_description" input - And I should see "ISC License (ISC)" in the "repository_license" select + When I follow the edit link for "My Name" repository + Then I should see "My Name" in the "repository_name" + And I should see "My Description" in the "repository_description" + And I should see "ISC License (ISC)" in the "repository_license" And I should see "Not Periodically" in the process period select field - And I should see "GIT" in the "repository_type" select - And I should see "https://github.com/user/project.git" in the "repository_address" input + And I should see "GIT" in the "repository_type" + And I should see "https://github.com/user/project.git" in the "repository_address" And I should see "Sample Configuration" in the repository configuration select field - #FIXME: Check the new rule "I have a Mezuro repository" @selenium Scenario: I edit a Mezuro repository with valid attributes - Given I follow "Add Repository" - And I fill the fields with the new following data - | repository_name | My Name | - | repository_description | My Description | - | repository_license | ISC License (ISC) | - | repository_process_period | Not Periodically | - | repository_type | GIT | - | repository_address | https://github.com/user/project.git | - | repository_configuration_id | Sample Configuration | - And I press "Add" + Given I have a Mezuro repository with the following data + | name | My Name | + | description | My Description | + | license | ISC License (ISC) | + | process_period | Not Periodically | + | type | GIT | + | address | https://github.com/user/project.git | + | configuration_id | Sample Configuration | And I am on article "Sample Project" - When I follow "Edit" + When I follow the edit link for "My Name" repository And I fill the fields with the new following data | repository_name | Another Name | | repository_description | Another Description | @@ -151,7 +147,7 @@ Feature: Repository | repository_address | https://project.svn.sourceforge.net/svnroot/project | | repository_configuration_id | Sample Configuration | And I press "Add" - Then I should see "Another Name" + Then I should see "Another Name" And I should see "Another Description" And I should see "Apple Public Source License (APSL-2.0)" And I should see "Weekly" @@ -159,68 +155,79 @@ Feature: Repository And I should see "https://project.svn.sourceforge.net/svnroot/project" And I should see "Sample Configuration" - #FIXME: Check the new rule "I have a Mezuro repository" @selenium Scenario: I try to edit a Mezuro repository leaving empty its title - Given I follow "Add Repository" - And I fill the fields with the new following data - | repository_name | My Name | - | repository_description | My Description | - | repository_license | ISC License (ISC) | - | repository_process_period | Not Periodically | - | repository_type | GIT | - | repository_address | https://github.com/user/project.git | - | repository_configuration_id | Sample Configuration | - And I press "Add" - And I am on article "Sample Project" - And I follow "Edit" + Given I have a Mezuro repository with the following data + | name | My Name | + | description | My Description | + | license | ISC License (ISC) | + | process_period | Not Periodically | + | type | GIT | + | address | https://github.com/user/project.git | + | configuration_id | Sample Configuration | + And I am on article "Sample Project" + And I follow the edit link for "My Name" repository When I erase the "repository_name" field And I press "Add" Then I should see "Please fill all fields marked with (*)." inside an alert - #FIXME: Check the new rule "I have a Mezuro repository" @selenium Scenario: I try to edit a Mezuro repository leaving empty its address - Given I follow "Add Repository" - And I fill the fields with the new following data - | repository_name | My Name | - | repository_description | My Description | - | repository_license | ISC License (ISC) | - | repository_process_period | Not Periodically | - | repository_type | GIT | - | repository_address | https://github.com/user/project.git | - | repository_configuration_id | Sample Configuration | - And I press "Add" - And I am on article "Sample Project" - And I follow "Edit" + Given I have a Mezuro repository with the following data + | name | My Name | + | description | My Description | + | license | ISC License (ISC) | + | process_period | Not Periodically | + | type | GIT | + | address | https://github.com/user/project.git | + | configuration_id | Sample Configuration | + And I am on article "Sample Project" + And I follow the edit link for "My Name" repository When I erase the "repository_address" field And I press "Add" Then I should see "Please fill all fields marked with (*)." inside an alert - #FIXME: Check the new rule "I have a Mezuro repository" @selenium - Scenario: I try to edit a repository with an existing repository name - Given I follow "Add Repository" - And I fill the fields with the new following data - | repository_name | My Name | - | repository_description | My Description | - | repository_license | ISC License (ISC) | - | repository_process_period | Not Periodically | - | repository_type | GIT | - | repository_address | https://github.com/user/project.git | - | repository_configuration_id | Sample Configuration | - And I press "Add" + Scenario: I try to edit a Mezuro repository with an invalid address + Given I have a Mezuro repository with the following data + | name | My Name | + | description | My Description | + | license | ISC License (ISC) | + | process_period | Not Periodically | + | type | GIT | + | address | https://github.com/user/project.git | + | configuration_id | Sample Configuration | And I am on article "Sample Project" - And I follow "Add Repository" + When I follow the edit link for "My Name" repository And I fill the fields with the new following data | repository_name | Another Name | | repository_description | Another Description | | repository_license | Apple Public Source License (APSL-2.0) | | repository_process_period | Weekly | | repository_type | SUBVERSION | - | repository_address | https://project.svn.sourceforge.net/svnroot/project | + | repository_address | https://invalid-address.any-extension | | repository_configuration_id | Sample Configuration | And I press "Add" + Then I should see "Address does not match type SUBVERSION chosen." inside an alert + + @selenium + Scenario: I try to edit a repository with an existing repository name + Given I have a Mezuro repository with the following data + | name | My Name | + | description | My Description | + | license | ISC License (ISC) | + | process_period | Not Periodically | + | type | GIT | + | address | https://github.com/user/project.git | + | configuration_id | Sample Configuration | + And I have a Mezuro repository with the following data + | name | Another Name | + | description | Another Description | + | license | Apple Public Source License (APSL-2.0) | + | process_period | Weekly | + | type | SUBVERSION | + | address | https://project.svn.sourceforge.net/svnroot/project | + | configuration_id | Sample Configuration | And I am on article "Sample Project" When I follow the edit link for "My Name" repository And I fill the fields with the new following data @@ -235,19 +242,35 @@ Feature: Repository #Then I should see "Slug The title (article name) is already being used by another article, please use another title." #FIXME fix this validation - #FIXME: Need to define permissions? @selenium - Scenario: I delete a Mezuro repository - Given I follow "Add Repository" - And I fill the fields with the new following data - | repository_name | My Name | - | repository_description | My Description | - | repository_license | ISC License (ISC) | - | repository_process_period | Not Periodically | - | repository_type | GIT | - | repository_address | https://github.com/user/project.git | - | repository_configuration_id | Sample Configuration | - And I press "Add" + Scenario: I delete a Mezuro repository of mine + Given I have a Mezuro repository with the following data + | name | My Name | + | description | My Description | + | license | ISC License (ISC) | + | process_period | Not Periodically | + | type | GIT | + | address | https://github.com/user/project.git | + | configuration_id | Sample Configuration | And I am on article "Sample Project" When I follow the remove link for "My Name" repository Then I should not see "My Name" + + @selenium + Scenario: I try to edit or delete a Mezuro repository which doesn't belong to me + Given I have a Mezuro repository with the following data + | name | My Name | + | description | My Description | + | license | ISC License (ISC) | + | process_period | Not Periodically | + | type | GIT | + | address | https://github.com/user/project.git | + | configuration_id | Sample Configuration | + And the following users + | login | name | + | zacarias | Zacarias | + And I am logged in as "zacarias" + When I am on article "Sample Project" + Then I should not see the edit link for "My Name" repository + And I should not see the remove link for "My Name" repository + diff --git a/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb b/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb index d1fc6be..fd49a53 100644 --- a/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb +++ b/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb @@ -16,7 +16,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper def self.license_options options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yml") - options = options.split(";") + options = options.split("; ") options end diff --git a/plugins/mezuro/licenses.yml.example b/plugins/mezuro/licenses.yml.example index d3f910e..df9efff 100644 --- a/plugins/mezuro/licenses.yml.example +++ b/plugins/mezuro/licenses.yml.example @@ -66,4 +66,4 @@ W3C License (W3C); wxWindows Library License (WXwindows); X.Net License (Xnet); Zope Public License 2.0 (ZPL-2.0); -zlib/libpng license (Zlib); +zlib/libpng license (Zlib) -- libgit2 0.21.2