Skip to content

Commit

Permalink
add basic test to make sure handler is registered
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Nov 22, 2024
1 parent 2600401 commit d4152dd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions spec/requests/reports_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require "rails_helper"

RSpec.describe "Reports" do
let(:user) { create :user }
let(:report_body) {
<<-EOF
{
"@context":"https://www.w3.org/ns/activitystreams",
"id":"https://mastodon.me.uk/d977f377-214b-4efd-8a47-70a37fb7ea20",
"type":"Flag",
"actor":"https://mastodon.me.uk/actor",
"content":"Test, please ignore",
"object":[
"https://example.com/models/abc123"
]
}
EOF
}

it "should call registered Report handler when a flag is received by Federails" do
expect(Report).to receive(:handle_flag).once.and_call_original
post user.actor.inbox_url, params: report_body, headers: { content_type: "application/activity" }
end

Check failure on line 24 in spec/requests/reports_spec.rb

View workflow job for this annotation

GitHub Actions / lint

Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end.
end

0 comments on commit d4152dd

Please sign in to comment.