Skip to content

Commit

Permalink
use note as reported object in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Nov 27, 2024
1 parent b96e7a4 commit e742637
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion spec/models/report_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 5 additions & 4 deletions spec/requests/reports_spec.rb
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -8,19 +9,19 @@
"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

it "should call registered Report handler when a flag is received by Federails" do
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
4 changes: 2 additions & 2 deletions spec/services/report_creation_service_spec.rb
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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}"
]
} }

Expand Down

0 comments on commit e742637

Please sign in to comment.