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