Adjust response results in list controller tests

This commit is contained in:
Andreas Nedbal 2022-07-09 19:05:35 +02:00 committed by Karina Kwiatek
parent a5b6ef07d3
commit 0555279cd2
1 changed files with 8 additions and 31 deletions

View File

@ -40,7 +40,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do
let(:expected_response) do let(:expected_response) do
{ {
"success" => false, "success" => false,
"status" => "toolong", "status" => "parameter_error",
"message" => anything "message" => anything
} }
end end
@ -57,7 +57,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do
let(:expected_response) do let(:expected_response) do
{ {
"success" => false, "success" => false,
"status" => "notfound", "status" => "not_found",
"message" => anything "message" => anything
} }
end end
@ -74,7 +74,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do
let(:expected_response) do let(:expected_response) do
{ {
"success" => false, "success" => false,
"status" => "toolong", "status" => "err",
"message" => anything "message" => anything
} }
end end
@ -91,7 +91,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do
let(:expected_response) do let(:expected_response) do
{ {
"success" => false, "success" => false,
"status" => "exists", "status" => "err",
"message" => anything "message" => anything
} }
end end
@ -117,15 +117,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do
end end
context "when user is not signed in" do context "when user is not signed in" do
let(:expected_response) do it_behaves_like "requires login"
{
"success" => false,
"status" => "noauth",
"message" => anything
}
end
include_examples "returns the expected response"
end end
end end
@ -212,15 +204,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do
end end
context "when user is not signed in" do context "when user is not signed in" do
let(:expected_response) do it_behaves_like "requires login"
{
"success" => false,
"status" => "noauth",
"message" => anything
}
end
include_examples "returns the expected response"
end end
end end
@ -302,7 +286,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do
let(:expected_response) do let(:expected_response) do
{ {
"success" => false, "success" => false,
"status" => "notfound", "status" => "not_found",
"message" => anything "message" => anything
} }
end end
@ -359,15 +343,8 @@ describe Ajax::ListController, :ajax_controller, type: :controller do
context "when user is not signed in" do context "when user is not signed in" do
let(:add_param) { "whatever" } let(:add_param) { "whatever" }
let(:expected_response) do
{
"success" => false,
"status" => "noauth",
"message" => anything
}
end
include_examples "returns the expected response" it_behaves_like "requires login"
end end
end end
end end