Skip to content

Commit

Permalink
Add tests for redirect confirmations (#28903)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire committed Jan 25, 2024
1 parent c50274a commit 0471a78
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions spec/features/redirections_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

require 'rails_helper'

describe 'redirection confirmations' do
let(:account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/foo', url: 'https://example.com/@foo') }
let(:status) { Fabricate(:status, account: account, uri: 'https://example.com/users/foo/statuses/1', url: 'https://example.com/@foo/1') }

context 'when a logged out user visits a local page for a remote account' do
it 'shows a confirmation page' do
visit "/@#{account.pretty_acct}"

# It explains about the redirect
expect(page).to have_content(I18n.t('redirects.title', instance: 'cb6e6126.ngrok.io'))

# It features an appropriate link
expect(page).to have_link(account.url, href: account.url)
end
end

context 'when a logged out user visits a local page for a remote status' do
it 'shows a confirmation page' do
visit "/@#{account.pretty_acct}/#{status.id}"

# It explains about the redirect
expect(page).to have_content(I18n.t('redirects.title', instance: 'cb6e6126.ngrok.io'))

# It features an appropriate link
expect(page).to have_link(status.url, href: status.url)
end
end
end

0 comments on commit 0471a78

Please sign in to comment.