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