From e147947eb8c6e1d4ef53c49d502818def80786ce Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 9 Dec 2025 04:27:29 -0500 Subject: [PATCH] Add wrapstodon page spec (#37168) --- spec/requests/wrapstodon_spec.rb | 19 +++++++++++++++++++ spec/system/wrapstodon_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 spec/requests/wrapstodon_spec.rb create mode 100644 spec/system/wrapstodon_spec.rb diff --git a/spec/requests/wrapstodon_spec.rb b/spec/requests/wrapstodon_spec.rb new file mode 100644 index 0000000000..62bd4dacd9 --- /dev/null +++ b/spec/requests/wrapstodon_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'Wrapstodon' do + let(:generated_annual_report) { AnnualReport.new(user.account, Time.current.year).generate } + let(:user) { Fabricate :user } + + describe 'GET /@:account_username/wrapstodon/:year/:share_key' do + context 'when share_key is invalid' do + it 'returns not found' do + get public_wrapstodon_path(account_username: user.account.username, year: generated_annual_report.year, share_key: 'sharks') + + expect(response) + .to have_http_status(404) + end + end + end +end diff --git a/spec/system/wrapstodon_spec.rb b/spec/system/wrapstodon_spec.rb new file mode 100644 index 0000000000..67d544dd47 --- /dev/null +++ b/spec/system/wrapstodon_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'Wrapstodon' do + describe 'Viewing a wrapstodon' do + let(:generated_annual_report) { AnnualReport.new(user.account, Time.current.year).generate } + let(:user) { Fabricate :user } + + context 'when signed in' do + before { sign_in user } + + it 'visits the wrap page and renders the web app' do + visit public_wrapstodon_path(account_username: user.account.username, year: generated_annual_report.year, share_key: generated_annual_report.share_key) + + expect(page) + .to have_css('#wrapstodon') + .and have_private_cache_control + end + end + end +end