From e7426371ac1f336599ba6e734ac83b827f8a30c4 Mon Sep 17 00:00:00 2001 From: James Smith Date: Wed, 27 Nov 2024 15:39:34 +0000 Subject: [PATCH] use note as reported object in tests --- spec/models/report_spec.rb | 2 +- spec/requests/reports_spec.rb | 9 +++++---- spec/services/report_creation_service_spec.rb | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb index f839200..bd07631 100644 --- a/spec/models/report_spec.rb +++ b/spec/models/report_spec.rb @@ -1,6 +1,6 @@ RSpec.describe Federails::Moderation::Report do let(:actor) { create :distant_actor } - let(:object) { create :user } + let(:object) { create :note } let(:report) { create :report, federails_actor: actor, object: object } it "is reported by an actor" do diff --git a/spec/requests/reports_spec.rb b/spec/requests/reports_spec.rb index 04566dc..1610890 100644 --- a/spec/requests/reports_spec.rb +++ b/spec/requests/reports_spec.rb @@ -1,5 +1,6 @@ RSpec.describe "Reports" do - let(:object) { create :user } + let(:user) { create :user } + let(:object) { create :note } let(:actor) { create :distant_actor } let(:valid_activity) { { "@context" => "https://www.w3.org/ns/activitystreams", @@ -8,12 +9,12 @@ "actor" => actor.federated_url, "content" => "I don't like spiders", "object" => [ - object.federails_actor.federated_url + "http://localhost:3000/notes/#{object.to_param}" ] } } it "should accept Flag activities" do - post object.federails_actor.inbox_url, params: valid_activity, as: :json + post user.federails_actor.inbox_url, params: valid_activity, as: :json expect(response.status).to eq 201 end @@ -21,6 +22,6 @@ expect(Federails::Moderation::ReportCreationService).to receive(:call).once { |args| expect(args["content"]).to eq "I don't like spiders" } - post object.federails_actor.inbox_url, params: valid_activity, as: :json + post user.federails_actor.inbox_url, params: valid_activity, as: :json end end diff --git a/spec/services/report_creation_service_spec.rb b/spec/services/report_creation_service_spec.rb index eb51688..fa23166 100644 --- a/spec/services/report_creation_service_spec.rb +++ b/spec/services/report_creation_service_spec.rb @@ -1,5 +1,5 @@ RSpec.describe Federails::Moderation::ReportCreationService do - let(:object) { create :user } + let(:object) { create :note } let(:actor) { create :distant_actor } let(:valid_activity) { { "@context" => "https://www.w3.org/ns/activitystreams", @@ -8,7 +8,7 @@ "actor" => actor.federated_url, "content" => "I don't like spiders", "object" => [ - object.federails_actor.federated_url + "http://localhost:3000/notes/#{object.to_param}" ] } }