Commit 8a887de79899604206dd718ac3b2431cdd47c4e2
Committed by
Paulo Meireles
1 parent
5e0aca6b
Exists in
master
and in
29 other branches
[Mezuro] Added acceptance test for reading group feature
Showing
2 changed files
with
117 additions
and
4 deletions
Show diff stats
features/step_definitions/mezuro_steps.rb
@@ -43,20 +43,24 @@ Then /^I should not see "([^"]*)" button$/ do |button_name| | @@ -43,20 +43,24 @@ Then /^I should not see "([^"]*)" button$/ do |button_name| | ||
43 | find_button(button_name).should be_nil | 43 | find_button(button_name).should be_nil |
44 | end | 44 | end |
45 | 45 | ||
46 | -When /^I have a Mezuro project with the following data$/ do |fields| | 46 | +When /^I have a Mezuro (project|reading group) with the following data$/ do |type,fields| |
47 | item = {} | 47 | item = {} |
48 | fields.rows_hash.each do |name, value| | 48 | fields.rows_hash.each do |name, value| |
49 | - if(name=="community" or name=="user") | 49 | + if(name=="user" or name=="community") |
50 | item.merge!(:profile=>Profile[value]) | 50 | item.merge!(:profile=>Profile[value]) |
51 | else | 51 | else |
52 | item.merge!(name => value) | 52 | item.merge!(name => value) |
53 | end | 53 | end |
54 | end | 54 | end |
55 | - result = MezuroPlugin::ProjectContent.new(item) | 55 | + if(type=="project") |
56 | + result = MezuroPlugin::ProjectContent.new(item) | ||
57 | + elsif(type=="reading group") | ||
58 | + result = MezuroPlugin::ReadingGroupContent.new(item) | ||
59 | + end | ||
56 | result.save! | 60 | result.save! |
57 | end | 61 | end |
58 | 62 | ||
59 | -When /^I update this Mezuro project with the following data$/ do |fields| | 63 | +When /^I update this Mezuro (project|reading group) with the following data$/ do |type, fields| |
60 | find_field("article_name").set fields.rows_hash[:Title] | 64 | find_field("article_name").set fields.rows_hash[:Title] |
61 | find_field("article_description").set fields.rows_hash[:Description] | 65 | find_field("article_description").set fields.rows_hash[:Description] |
62 | end | 66 | end |
plugins/mezuro/features/reading_group.feature
@@ -24,3 +24,112 @@ Feature: Reading Group | @@ -24,3 +24,112 @@ Feature: Reading Group | ||
24 | And I should see "Sample Description" | 24 | And I should see "Sample Description" |
25 | And I should see "Readings" | 25 | And I should see "Readings" |
26 | And I should see "Add Reading" | 26 | And I should see "Add Reading" |
27 | + | ||
28 | + Scenario: I try to create a Mezuro reading group without title | ||
29 | + Given I am on joaosilva's control panel | ||
30 | + And I follow "Mezuro reading group" | ||
31 | + And the field "article_name" is empty | ||
32 | + When I press "Save" | ||
33 | + Then I should see "Title can't be blank" | ||
34 | + | ||
35 | + Scenario: I try to create a Mezuro reading group with title already in use | ||
36 | + Given I have a Mezuro reading group with the following data | ||
37 | + | name | Sample Reading group | | ||
38 | + | description | Sample Description | | ||
39 | + | user | joaosilva | | ||
40 | + And I am on joaosilva's control panel | ||
41 | + When I create a Mezuro reading group with the following data | ||
42 | + | Title | Sample Reading Group | | ||
43 | + | Description | Sample Description | | ||
44 | + Then I should see "Slug The title (article name) is already being used by another article, please use another title." | ||
45 | + | ||
46 | +@selenium | ||
47 | + Scenario: I see a Mezuro reading group edit form | ||
48 | + Given I have a Mezuro reading group with the following data | ||
49 | + | name | Sample Reading group | | ||
50 | + | description | Sample Description | | ||
51 | + | user | joaosilva | | ||
52 | + And I am on article "Sample Reading group" | ||
53 | + And I should be on /joaosilva/sample-reading-group | ||
54 | + When I follow "Edit" | ||
55 | + Then I should see "Sample Reading group" in the "article_name" input | ||
56 | + And I should see "Sample Description" in the "article_description" input | ||
57 | + And I should see "Save" button | ||
58 | + | ||
59 | +@selenium | ||
60 | + Scenario: I edit a Mezuro reading group with valid attributes | ||
61 | + Given I have a Mezuro reading group with the following data | ||
62 | + | name | Sample Reading group | | ||
63 | + | description | Sample Description | | ||
64 | + | user | joaosilva | | ||
65 | + And I am on article "Sample Reading group" | ||
66 | + And I should be on /joaosilva/sample-reading-group | ||
67 | + And I follow "Edit" | ||
68 | + When I update this Mezuro reading group with the following data | ||
69 | + | Title | Another Reading group | | ||
70 | + | Description | Another Description | | ||
71 | + And I press "Save" | ||
72 | + Then I should see "Another Reading group" | ||
73 | + And I should see "Another Description" | ||
74 | + And I should see "Add Reading" | ||
75 | + | ||
76 | +@selenium | ||
77 | + Scenario: I try to edit a Mezuro reading group leaving empty its title | ||
78 | + Given I have a Mezuro reading group with the following data | ||
79 | + | name | Sample Reading group | | ||
80 | + | description | Sample Description | | ||
81 | + | user | joaosilva | | ||
82 | + And I am on article "Sample Reading group" | ||
83 | + And I should be on /joaosilva/sample-reading-group | ||
84 | + And I follow "Edit" | ||
85 | + When I erase the "article_name" field | ||
86 | + And I press "Save" | ||
87 | + Then I should see "Title can't be blank" | ||
88 | + | ||
89 | +@selenium | ||
90 | + Scenario: I try to edit a Mezuro reading group with title of an existing Mezuro Reading group | ||
91 | + Given I have a Mezuro reading group with the following data | ||
92 | + | name | Sample Reading group | | ||
93 | + | description | Sample Description | | ||
94 | + | user | joaosilva | | ||
95 | + And I have a Mezuro reading group with the following data | ||
96 | + | name | Another Reading group | | ||
97 | + | description | Another Description | | ||
98 | + | user | joaosilva | | ||
99 | + And I am on article "Sample Reading group" | ||
100 | + And I should be on /joaosilva/sample-reading-group | ||
101 | + And I follow "Edit" | ||
102 | + When I update this Mezuro reading group with the following data | ||
103 | + | Title | Another Reading group | | ||
104 | + | Description | Another Description | | ||
105 | + And I press "Save" | ||
106 | + Then I should see "Slug The title (article name) is already being used by another article, please use another title." | ||
107 | + | ||
108 | +@selenium | ||
109 | + Scenario: I delete a Mezuro reading group that belongs to me | ||
110 | + Given I have a Mezuro reading group with the following data | ||
111 | + | name | Sample Reading group | | ||
112 | + | description | Sample Description | | ||
113 | + | user | joaosilva | | ||
114 | + And I am on article "Sample Reading group" | ||
115 | + And I should be on /joaosilva/sample-reading-group | ||
116 | + When I follow "Delete" | ||
117 | + And I confirm the "Are you sure that you want to remove the item "Sample Reading group"?" dialog | ||
118 | + Then I go to /joaosilva/sample-reading-group | ||
119 | + And I should see "There is no such page: /joaosilva/sample-reading-group" | ||
120 | + | ||
121 | +@selenium | ||
122 | + Scenario: I cannot edit or delete a Mezuro reading group that doesn't belong to me | ||
123 | + Given I have a Mezuro reading group with the following data | ||
124 | + | name | Sample Reading group | | ||
125 | + | description | Sample Description | | ||
126 | + | user | joaosilva | | ||
127 | + And the following users | ||
128 | + | login | name | | ||
129 | + | adminuser | Admin | | ||
130 | + And I am logged in as "adminuser" | ||
131 | + When I am on article "Sample Reading group" | ||
132 | + And I should be on /joaosilva/sample-reading-group | ||
133 | + Then I should not see "Delete" | ||
134 | + And I should not see "Edit" | ||
135 | + |