From 0555279cd2cc0ab2a23b097e10e29632f9df6d35 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 9 Jul 2022 19:05:35 +0200 Subject: [PATCH] Adjust response results in list controller tests --- spec/controllers/ajax/list_controller_spec.rb | 39 ++++--------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/spec/controllers/ajax/list_controller_spec.rb b/spec/controllers/ajax/list_controller_spec.rb index 05086587..d14939ce 100644 --- a/spec/controllers/ajax/list_controller_spec.rb +++ b/spec/controllers/ajax/list_controller_spec.rb @@ -40,7 +40,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do let(:expected_response) do { "success" => false, - "status" => "toolong", + "status" => "parameter_error", "message" => anything } end @@ -57,7 +57,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do let(:expected_response) do { "success" => false, - "status" => "notfound", + "status" => "not_found", "message" => anything } end @@ -74,7 +74,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do let(:expected_response) do { "success" => false, - "status" => "toolong", + "status" => "err", "message" => anything } end @@ -91,7 +91,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do let(:expected_response) do { "success" => false, - "status" => "exists", + "status" => "err", "message" => anything } end @@ -117,15 +117,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do end context "when user is not signed in" do - let(:expected_response) do - { - "success" => false, - "status" => "noauth", - "message" => anything - } - end - - include_examples "returns the expected response" + it_behaves_like "requires login" end end @@ -212,15 +204,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do end context "when user is not signed in" do - let(:expected_response) do - { - "success" => false, - "status" => "noauth", - "message" => anything - } - end - - include_examples "returns the expected response" + it_behaves_like "requires login" end end @@ -302,7 +286,7 @@ describe Ajax::ListController, :ajax_controller, type: :controller do let(:expected_response) do { "success" => false, - "status" => "notfound", + "status" => "not_found", "message" => anything } end @@ -359,15 +343,8 @@ describe Ajax::ListController, :ajax_controller, type: :controller do context "when user is not signed in" do 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