From 964ec12a386eaa919b908715be0adae5683f883a Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Fri, 1 Mar 2024 20:54:46 +0100 Subject: [PATCH] Add specs for `SocialHelper::BlueskyMethods` --- .../social_helper/bluesky_methods_spec.rb | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 spec/helpers/social_helper/bluesky_methods_spec.rb diff --git a/spec/helpers/social_helper/bluesky_methods_spec.rb b/spec/helpers/social_helper/bluesky_methods_spec.rb new file mode 100644 index 00000000..a00615af --- /dev/null +++ b/spec/helpers/social_helper/bluesky_methods_spec.rb @@ -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