Retrospring/spec/helpers/social_helper_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
827 B
Ruby
Raw Normal View History

2023-10-16 06:20:24 -07:00
# frozen_string_literal: true
require "rails_helper"
describe SocialHelper, type: :helper do
let(:user) { FactoryBot.create(:user) }
let(:answer) do
FactoryBot.create(
:answer,
user:,
content: "this is an answer\nwith multiple lines\nand **FORMATTING**",
2023-10-16 06:32:48 -07:00
question_content: "this is a question .... or is it?",
2023-10-16 06:20:24 -07:00
)
end
before do
stub_const("APP_CONFIG", {
"hostname" => "example.com",
"https" => true,
"items_per_page" => 5,
},)
2023-10-16 06:20:24 -07:00
end
describe "#answer_share_url" do
subject { answer_share_url(answer) }
it "returns a proper share link" do
expect(subject).to eq(<<~URL.strip)
https://example.com/@#{answer.user.screen_name}/a/#{answer.id}
URL
end
end
end