Add tests for commenting on answers while blocked
This commit is contained in:
parent
0eb3f53b45
commit
25ed1e4605
|
@ -15,6 +15,8 @@ en:
|
||||||
following_self_blocked_other: "You cannot follow a user who you are currently blocking"
|
following_self_blocked_other: "You cannot follow a user who you are currently blocking"
|
||||||
answering_self_blocked_other: "You cannot answer a question from a user who you are currently blocking"
|
answering_self_blocked_other: "You cannot answer a question from a user who you are currently blocking"
|
||||||
answering_other_blocked_self: "You cannot answer this question as you have been blocked its author"
|
answering_other_blocked_self: "You cannot answer this question as you have been blocked its author"
|
||||||
|
commenting_self_blocked_other: "You cannot comment on this answer as you have blocked its author"
|
||||||
|
commenting_other_blocked_self: "You cannot comment on this answer as you have been blocked by its author"
|
||||||
self_action: "You cannot do this to yourself"
|
self_action: "You cannot do this to yourself"
|
||||||
following_self: "You cannot follow yourself"
|
following_self: "You cannot follow yourself"
|
||||||
blocking_self: "You cannot block yourself"
|
blocking_self: "You cannot block yourself"
|
||||||
|
|
|
@ -66,6 +66,40 @@ describe Ajax::CommentController, :ajax_controller, type: :controller do
|
||||||
|
|
||||||
include_examples "does not create the comment"
|
include_examples "does not create the comment"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when the user is blocked by the answer's author" do
|
||||||
|
before do
|
||||||
|
answer.user.block(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:comment) { ">:3" }
|
||||||
|
let(:expected_response) do
|
||||||
|
{
|
||||||
|
"success" => false,
|
||||||
|
"status" => "commenting_other_blocked_self",
|
||||||
|
"message" => I18n.t("errors.commenting_other_blocked_self")
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples "does not create the comment"
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when the user is blocking the answer's author" do
|
||||||
|
before do
|
||||||
|
user.block(answer.user)
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:comment) { "heast" }
|
||||||
|
let(:expected_response) do
|
||||||
|
{
|
||||||
|
"success" => false,
|
||||||
|
"status" => "commenting_self_blocked_other",
|
||||||
|
"message" => I18n.t("errors.commenting_self_blocked_other")
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples "does not create the comment"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when answer does not exist" do
|
context "when answer does not exist" do
|
||||||
|
|
Loading…
Reference in New Issue