Add tests for removing anonymous blocks

This commit is contained in:
Karina Kwiatek 2022-06-15 00:15:35 +02:00 committed by Karina Kwiatek
parent cd3f1591c9
commit 1e86043750
1 changed files with 27 additions and 1 deletions

View File

@ -54,6 +54,32 @@ describe Ajax::AnonymousBlockController, :ajax_controller, type: :controller do
end
describe "#destroy" do
pending
subject { delete(:destroy, params: params) }
context "user signed in" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in(user)
end
context "when all parameters are given" do
let(:question) { FactoryBot.create(:question, author_identifier: "someidentifier") }
let(:block) { AnonymousBlock.create(user: user, identifier: "someidentifier", question: question) }
let(:params) do
{ id: block.id }
end
let(:expected_response) do
{
"success" => true,
"status" => "okay",
"message" => anything
}
end
include_examples "returns the expected response"
end
end
end
end