File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,4 +37,13 @@ Feature: The Hackety Blog
3737 And I am on the post page for the post with the title "new title"
3838 And I should see "new title"
3939 And I should see "new body"
40-
40+ Scenario : Not logged in users cannot edit a post
41+ Given I'm not logged in
42+ And there is a blog post with the title "First Post"
43+ And I go to the edit post page for the post with the title "First Post"
44+ Then I should see "Sorry, buddy"
45+ Scenario : Non-admin users cannot edit a post
46+ Given I'm logged in
47+ And there is a blog post with the title "First Post"
48+ And I go to the edit post page for the post with the title "First Post"
49+ Then I should see "Sorry, buddy"
Original file line number Diff line number Diff line change 5858end
5959
6060get "/posts/:id/edit" do
61+ unless current_user . admin?
62+ flash [ :notice ] = "Sorry, buddy"
63+ redirect "/posts"
64+ end
65+
6166 @post = Post . find ( params [ :id ] )
6267 haml :posts_edit
6368end
You can’t perform that action at this time.
0 commit comments