post disapprovals: fix tests and API create action.
* Fix tests. * Fix create action in API (couldn't redirect to show action). * Clean up user initialization.
This commit is contained in:
@@ -14,7 +14,7 @@ class PostDisapprovalsControllerTest < ActionDispatch::IntegrationTest
|
||||
context "create action" do
|
||||
should "render" do
|
||||
assert_difference("PostDisapproval.count", 1) do
|
||||
post_auth moderator_post_disapprovals_path, @admin, params: { post_disapproval: { post_id: @post.id, reason: "breaks_rules" }, format: "js" }
|
||||
post_auth post_disapprovals_path, @admin, params: { post_disapproval: { post_id: @post.id, reason: "breaks_rules" }, format: "js" }
|
||||
end
|
||||
assert_response :success
|
||||
end
|
||||
@@ -22,7 +22,7 @@ class PostDisapprovalsControllerTest < ActionDispatch::IntegrationTest
|
||||
context "for json" do
|
||||
should "render" do
|
||||
assert_difference("PostDisapproval.count", 1) do
|
||||
post_auth moderator_post_disapprovals_path, @admin, params: { post_disapproval: { post_id: @post.id, reason: "breaks_rules" }, format: "json" }
|
||||
post_auth post_disapprovals_path, @admin, params: { post_disapproval: { post_id: @post.id, reason: "breaks_rules" }, format: "json" }
|
||||
end
|
||||
assert_response :success
|
||||
end
|
||||
@@ -32,7 +32,7 @@ class PostDisapprovalsControllerTest < ActionDispatch::IntegrationTest
|
||||
context "index action" do
|
||||
should "render" do
|
||||
disapproval = FactoryBot.create(:post_disapproval, post: @post)
|
||||
get_auth moderator_post_disapprovals_path, @admin
|
||||
get_auth post_disapprovals_path, @admin
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user