Commit 6a1964325ad74966d9041f329d84192a5b69fedb

Authored by Antonio Terceiro
1 parent a8418460

Adding step to remove all articles from a profile

This is saner than clicking "Delete" an arbitrary number of times (this
could break at any time in the future)

(ActionItem1309)
features/publish_article.feature
@@ -8,6 +8,8 @@ Feature: publish article @@ -8,6 +8,8 @@ Feature: publish article
8 | login | name | 8 | login | name |
9 | joaosilva | Joao Silva | 9 | joaosilva | Joao Silva |
10 | mariasilva | Maria Silva | 10 | mariasilva | Maria Silva |
  11 + And "mariasilva" has no articles
  12 + And "joaosilva" has no articles
11 And the following communities 13 And the following communities
12 | identifier | name | 14 | identifier | name |
13 | sample-community | Sample Community | 15 | sample-community | Sample Community |
@@ -20,10 +22,6 @@ Feature: publish article @@ -20,10 +22,6 @@ Feature: publish article
20 And "Joao Silva" is a member of "Sample Community" 22 And "Joao Silva" is a member of "Sample Community"
21 And I am on Joao Silva's control panel 23 And I am on Joao Silva's control panel
22 And I follow "Manage Content" 24 And I follow "Manage Content"
23 - #These "deletes" are to remove default articles and spread the correct created one  
24 - And I follow "Delete"  
25 - And I follow "Delete"  
26 - And I follow "Delete"  
27 And I follow "Spread" 25 And I follow "Spread"
28 And I check "Sample Community" 26 And I check "Sample Community"
29 And I press "Publish" 27 And I press "Publish"
@@ -39,9 +37,6 @@ Feature: publish article @@ -39,9 +37,6 @@ Feature: publish article
39 And "Joao Silva" is a member of "Sample Community" 37 And "Joao Silva" is a member of "Sample Community"
40 And I am on Joao Silva's control panel 38 And I am on Joao Silva's control panel
41 And I follow "Manage Content" 39 And I follow "Manage Content"
42 - And I follow "Delete"  
43 - And I follow "Delete"  
44 - And I follow "Delete"  
45 And I follow "Spread" 40 And I follow "Spread"
46 And I check "Sample Community" 41 And I check "Sample Community"
47 And I press "Publish" 42 And I press "Publish"
@@ -55,9 +50,6 @@ Feature: publish article @@ -55,9 +50,6 @@ Feature: publish article
55 | Title | Sample Article | 50 | Title | Sample Article |
56 | Text | this is Maria's first published article | 51 | Text | this is Maria's first published article |
57 And I press "Save" 52 And I press "Save"
58 - And I follow "Delete"  
59 - And I follow "Delete"  
60 - And I follow "Delete"  
61 And I follow "Spread" 53 And I follow "Spread"
62 And I check "Sample Community" 54 And I check "Sample Community"
63 When I press "Publish" 55 When I press "Publish"
@@ -75,9 +67,6 @@ Feature: publish article @@ -75,9 +67,6 @@ Feature: publish article
75 And "Joao Silva" is a member of "Another Community2" 67 And "Joao Silva" is a member of "Another Community2"
76 And I am on Joao Silva's control panel 68 And I am on Joao Silva's control panel
77 And I follow "Manage Content" 69 And I follow "Manage Content"
78 - And I follow "Delete"  
79 - And I follow "Delete"  
80 - And I follow "Delete"  
81 And I follow "Spread" 70 And I follow "Spread"
82 And I check "Sample Community" 71 And I check "Sample Community"
83 And I press "Publish" 72 And I press "Publish"
@@ -107,9 +96,6 @@ Feature: publish article @@ -107,9 +96,6 @@ Feature: publish article
107 And I press "Save" 96 And I press "Save"
108 And I am on Joao Silva's control panel 97 And I am on Joao Silva's control panel
109 And I follow "Manage Content" 98 And I follow "Manage Content"
110 - And I follow "Delete"  
111 - And I follow "Delete"  
112 - And I follow "Delete"  
113 And I follow "Spread" 99 And I follow "Spread"
114 And I check "Sample Community" 100 And I check "Sample Community"
115 And I press "Publish" 101 And I press "Publish"
features/step_definitions/noosfero_steps.rb
@@ -107,3 +107,7 @@ Given /^"(.+)" is admin of "(.+)"$/ do |person, organization| @@ -107,3 +107,7 @@ Given /^"(.+)" is admin of "(.+)"$/ do |person, organization|
107 user = Profile.find_by_name(person) 107 user = Profile.find_by_name(person)
108 org.add_admin(user) 108 org.add_admin(user)
109 end 109 end
  110 +
  111 +Given /^"([^\"]*)" has no articles$/ do |profile|
  112 + (Profile[profile] || Profile.find_by_name(profile)).articles.delete_all
  113 +end