Commit 8ab93e08e5cd327983bc4029344f198bfa0f69b3

Authored by Alessandro Palmeira + Diego Araujo
Committed by Paulo Meireles
1 parent ac414a54

[Mezuro] Refactoring project feature - work in progress

features/step_definitions/mezuro_steps.rb
@@ -33,16 +33,15 @@ Then /^I should see "([^\"]*)" inside an alert$/ do |message| @@ -33,16 +33,15 @@ Then /^I should see "([^\"]*)" inside an alert$/ do |message|
33 selenium.chooseOkOnNextConfirmation(); 33 selenium.chooseOkOnNextConfirmation();
34 end 34 end
35 35
36 -Given /^the following Mezuro project$/ do |table|  
37 - table.hashes.map{|item| item.dup}.each do |item|  
38 - owner_identifier = item.delete("owner")  
39 - parent = item.delete("parent")  
40 - owner = Profile[owner_identifier]  
41 - item.merge!(:profile => owner)  
42 - result = MezuroPlugin::ProjectContent.new(item)  
43 - if !parent.blank?  
44 - result.parent = Article.find_by_name(parent) 36 +When /^I have a Mezuro project with the following data$/ do |fields|
  37 + item = {}
  38 + fields.rows_hash.each do |name, value|
  39 + if(name=="owner")
  40 + item.merge!(:profile=>Profile[value])
  41 + else
  42 + item.merge!(name => value)
45 end 43 end
46 - result.save!  
47 end 44 end
  45 + result = MezuroPlugin::ProjectContent.new(item)
  46 + result.save!
48 end 47 end
plugins/mezuro/features/project.feature
@@ -29,12 +29,14 @@ Feature: Project @@ -29,12 +29,14 @@ Feature: Project
29 And I should see "Sample Description" 29 And I should see "Sample Description"
30 And I should see "Add Repository" 30 And I should see "Add Repository"
31 31
32 - @selenium 32 + @selenium @current
33 Scenario: I edit a Mezuro project 33 Scenario: I edit a Mezuro project
34 - Given I am on mycommunity's control panel  
35 - When I create a Mezuro project with the following data  
36 - | Title | Sample Project |  
37 - | Description | Sample Description | 34 + When I have a Mezuro project with the following data
  35 + | name | Sample Project |
  36 + | description | Sample Description |
  37 + | owner | joaosilva |
  38 +# Next step should work, but profile for "Sample Description" article is wrong (should be "my-community" but is "joaosilva").
  39 +# Something in the previous step is not right.
38 And I am on article "Sample Project" 40 And I am on article "Sample Project"
39 And I should be on /mycommunity/sample-project 41 And I should be on /mycommunity/sample-project
40 When I follow "Edit" 42 When I follow "Edit"
plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb
@@ -16,4 +16,4 @@ @@ -16,4 +16,4 @@
16 16
17 <%= f.text_field :description %><br/> 17 <%= f.text_field :description %><br/>
18 18
19 -# partial rendered in app/views/cms/edit.rhtml 19 +<!-- partial rendered in app/views/cms/edit.rhtml -->