Add wrapstodon page spec (#37168)

This commit is contained in:
Matt Jankowski
2025-12-09 04:27:29 -05:00
committed by GitHub
parent 607449336d
commit e147947eb8
2 changed files with 41 additions and 0 deletions

View File

@@ -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

View File

@@ -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