File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 208208 sprockets (2.0.3 )
209209 hike (~> 1.2 )
210210 rack (~> 1.0 )
211- tilt (!= 1.3.0 , ~> 1.1 )
211+ tilt (~> 1.1 , != 1.3.0 )
212212 sqlite3 (1.3.5 )
213213 term-ansicolor (1.0.7 )
214214 thor (0.14.6 )
Original file line number Diff line number Diff line change 1+ Feature : Moderate questions
2+
3+ As a moderator, I should be able to delete questions from the site.
4+
5+ Background :
6+ Given there is a question from someone else
7+
8+ Scenario : Delete a question
9+ Given I am a moderator
10+ Then I can delete that question
11+
12+ Scenario : Normal users cannot moderate
13+ Given I am not a moderator
14+ Then I cannot delete that question
15+
Original file line number Diff line number Diff line change @@ -48,3 +48,30 @@ def create_question_for(user)
4848 visit user_path ( @user )
4949 page . should have_content ( "My Question" )
5050end
51+
52+ Given /^I am a moderator$/ do
53+ step %{a logged in user}
54+ @user . moderator = true
55+ @user . save
56+ end
57+
58+ Given /^I am not a moderator$/ do
59+ step %{a logged in user}
60+ @user . moderator = false
61+ @user . save
62+ end
63+
64+ Given /^there is a question from someone else$/ do
65+ @question = Question . create ( :title => "A question to delete" ,
66+ :description => "moderator should delete me!" )
67+ end
68+
69+ Then /^I can delete that question$/ do
70+ visit question_path ( @question )
71+ page . should have_content ( 'Delete' )
72+ end
73+
74+ Then /^I cannot delete that question$/ do
75+ visit question_path ( @question )
76+ page . should_not have_content ( 'Delete' )
77+ end
You can’t perform that action at this time.
0 commit comments