diff --git a/features/step_definitions/mezuro_steps.rb b/features/step_definitions/mezuro_steps.rb index cbed3a8..ca02ed3 100644 --- a/features/step_definitions/mezuro_steps.rb +++ b/features/step_definitions/mezuro_steps.rb @@ -56,11 +56,20 @@ 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 shoud 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 +end + Then /^I should not see "([^"]*)" button$/ do |button_name| find_button(button_name).should be_nil end -When /^I have a Mezuro (project|reading group|configuration) with the following data$/ do |type,fields| +When /^I have a Mezuro (project|reading group|configuration|repository) with the following data$/ do |type,fields| item = {} fields.rows_hash.each do |name, value| if(name=="user" or name=="community") @@ -76,7 +85,16 @@ When /^I have a Mezuro (project|reading group|configuration) with the following elsif (type == "configuration") result = MezuroPlugin::ConfigurationContent.new(item) end - result.save! + + if (type == "repository") + puts Kalibro::Configuration.all.last.id + puts Kalibro::Project.all.last.id + item.merge(:configuration_id => Kalibro::Configuration.all.last.id) + result = Kalibro::Repository.new(item) + raise (result.save Kalibro::Project.all.last.id).inspect + else + result.save! + end end When /^I erase the "([^"]*)" field$/ do |field_name| diff --git a/plugins/mezuro/features/repository.feature b/plugins/mezuro/features/repository.feature index bdd2b67..34a18f4 100644 --- a/plugins/mezuro/features/repository.feature +++ b/plugins/mezuro/features/repository.feature @@ -40,7 +40,7 @@ Feature: Repository And I should see "Add" button @selenium - Scenario: I want to add a repository with no name + Scenario: I try to add a repository with no name Given I follow "Add Repository" When I fill the fields with the new following data | repository_name | | @@ -54,7 +54,7 @@ Feature: Repository Then I should see "Please fill all fields marked with (*)." inside an alert @selenium - Scenario: I want to add a repository with no address + Scenario: I try to add a repository with no address Given I follow "Add Repository" When I fill the fields with the new following data | repository_name | My Name | @@ -68,7 +68,7 @@ Feature: Repository Then I should see "Please fill all fields marked with (*)." inside an alert @selenium - Scenario: I want to add a repository with a invalid address + Scenario: I try to add a repository with a invalid address Given I follow "Add Repository" When I fill the fields with the new following data | repository_name | My Name | @@ -101,5 +101,87 @@ Feature: Repository And I should see "https://github.com/user/project.git" And I should see "Sample Configuration" - #Scenario: I want to see the repository edit form - # Given I have a repository with the following data \ No newline at end of file + #FIXME: create the step given I have repository... + @selenium + Scenario: I want to see the repository edit form + 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" + 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 + 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 "Sample Configuration" in the "repository_configuration_id" select + + #FIXME: create the step given I have repository... + @selenium + Scenario: I want to see the repository edit form + 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" + 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 + 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 "2" in the "repository_configuration_id" select + + #FIXME: create the step given I have repository... + @selenium + Scenario: I try to edit a Mezuro project 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" + 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: create the step given I have repository... + @selenium + Scenario: I try to edit a Mezuro project 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" + When I erase the "repository_address" field + And I press "Add" + Then I should see "Please fill all fields marked with (*)." inside an alert + -- libgit2 0.21.2