Revisions
-
justinko renamed this gist
Jun 23, 2011 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,26 +2,26 @@ describe "PUT #update" do let(:post) { Factory(:post) } context "when logged in as post's author" do before { sign_in post.author } it "allows the post to be updated" do do_action response.should be_success end end context "when logged in as another user" do before { sign_in Factory(:user) } it "does not allow the post to be updated" do do_action response.should be_forbidden end end def do_action put :update, :id => post.id, :body => "new content" end end end -
alindeman revised this gist
Jun 21, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ let(:post) { Factory(:post) } before(:each) do sign_in user # user is defined as a memoized helper method using let { } below put :update, :id => post.id, :body => "new content" end -
alindeman revised this gist
Jun 21, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ let(:post) { Factory(:post) } before(:each) do login_as user # user is defined as a memoized helper method using let { } below put :update, :id => post.id, :body => "new content" end -
alindeman revised this gist
Jun 21, 2011 . 1 changed file with 9 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,22 +2,26 @@ describe "PUT #update" do let(:post) { Factory(:post) } before(:each) do login_as user put :update, :id => post.id, :body => "new content" end context "when logged in as post's author" do let(:user) { post.author } it "allows the post to be updated" do response.should be_success end end context "when logged in as another user" do let(:user) { Factory(:user) } it "does not allow the post to be updated" do response.should be_forbidden end end end end -
alindeman created this gist
Jun 21, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ describe PostsController do describe "PUT #update" do let(:post) { Factory(:post) } before do login_as user put :update, :id => post.id, :body => "new content" end context "logged in as post's author" do let(:user) { post.author } its(:response) { should be_success } end context "logged in as another user" do let(:user) { Factory(:user) } its(:response) { should be_forbidden } end end end