Add specs for `SocialHelper::BlueskyMethods`

This commit is contained in:
Andreas Nedbal 2024-03-01 20:54:46 +01:00 committed by Andreas Nedbal
parent 50e0a645fe
commit 964ec12a38
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
# frozen_string_literal: true
require "rails_helper"
describe SocialHelper::BlueskyMethods, type: :helper do
let(:user) { FactoryBot.create(:user) }
let(:question_content) { "q" * 255 }
let(:answer_content) { "a" * 255 }
let(:answer) do
FactoryBot.create(:answer, user:,
content: answer_content,
question_content:,)
end
before do
stub_const("APP_CONFIG", {
"hostname" => "example.com",
"https" => true,
"items_per_page" => 5,
},)
end
describe "#bluesky_share_url" do
subject { bluesky_share_url(answer) }
it "should return a proper share link" do
expect(subject).to eq("https://bsky.app/intent/compose?text=#{CGI.escape(prepare_tweet(answer))}")
end
end
end