From 8ab93e08e5cd327983bc4029344f198bfa0f69b3 Mon Sep 17 00:00:00 2001 From: Alessandro Palmeira + Diego Araujo Date: Thu, 3 Jan 2013 20:29:32 +0000 Subject: [PATCH] [Mezuro] Refactoring project feature - work in progress --- features/step_definitions/mezuro_steps.rb | 19 +++++++++---------- plugins/mezuro/features/project.feature | 12 +++++++----- plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/features/step_definitions/mezuro_steps.rb b/features/step_definitions/mezuro_steps.rb index 9a8c1ad..7248b1e 100644 --- a/features/step_definitions/mezuro_steps.rb +++ b/features/step_definitions/mezuro_steps.rb @@ -33,16 +33,15 @@ Then /^I should see "([^\"]*)" inside an alert$/ do |message| selenium.chooseOkOnNextConfirmation(); end -Given /^the following Mezuro project$/ do |table| - table.hashes.map{|item| item.dup}.each do |item| - owner_identifier = item.delete("owner") - parent = item.delete("parent") - owner = Profile[owner_identifier] - item.merge!(:profile => owner) - result = MezuroPlugin::ProjectContent.new(item) - if !parent.blank? - result.parent = Article.find_by_name(parent) +When /^I have a Mezuro project with the following data$/ do |fields| + item = {} + fields.rows_hash.each do |name, value| + if(name=="owner") + item.merge!(:profile=>Profile[value]) + else + item.merge!(name => value) end - result.save! end + result = MezuroPlugin::ProjectContent.new(item) + result.save! end diff --git a/plugins/mezuro/features/project.feature b/plugins/mezuro/features/project.feature index 23ff028..faba7f5 100644 --- a/plugins/mezuro/features/project.feature +++ b/plugins/mezuro/features/project.feature @@ -29,12 +29,14 @@ Feature: Project And I should see "Sample Description" And I should see "Add Repository" - @selenium + @selenium @current Scenario: I edit a Mezuro project - Given I am on mycommunity's control panel - When I create a Mezuro project with the following data - | Title | Sample Project | - | Description | Sample Description | + When I have a Mezuro project with the following data + | name | Sample Project | + | description | Sample Description | + | owner | joaosilva | +# Next step should work, but profile for "Sample Description" article is wrong (should be "my-community" but is "joaosilva"). +# Something in the previous step is not right. And I am on article "Sample Project" And I should be on /mycommunity/sample-project When I follow "Edit" diff --git a/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb b/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb index 11f1623..7826ee2 100644 --- a/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb +++ b/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb @@ -16,4 +16,4 @@ <%= f.text_field :description %>
-# partial rendered in app/views/cms/edit.rhtml + -- libgit2 0.21.2