Skip to content

Commit 9bfc87c

Browse files
committed
Add missing see_others
1 parent 64b1c47 commit 9bfc87c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

app/controllers/application_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def logged_in_user
88
unless logged_in?
99
store_location
1010
flash[:danger] = "Please log in."
11-
redirect_to login_url
11+
redirect_to login_url, status: :see_other
1212
end
1313
end
14-
end
14+
end

app/controllers/microposts_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ def micropost_params
3232

3333
def correct_user
3434
@micropost = current_user.microposts.find_by(id: params[:id])
35-
redirect_to root_url if @micropost.nil?
35+
redirect_to(root_url, status: :see_other) if @micropost.nil?
3636
end
3737
end

test/controllers/microposts_controller_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def setup
1717
assert_no_difference 'Micropost.count' do
1818
delete micropost_path(@micropost)
1919
end
20+
assert_response :see_other
2021
assert_redirected_to login_url
2122
end
2223

@@ -26,6 +27,7 @@ def setup
2627
assert_no_difference 'Micropost.count' do
2728
delete micropost_path(micropost)
2829
end
30+
assert_response :see_other
2931
assert_redirected_to root_url
3032
end
3133
end

0 commit comments

Comments
 (0)