2024-01-25 11:13:33 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 05:12:25 +00:00
|
|
|
RSpec.describe 'redirection confirmations' do
|
2024-01-25 11:13:33 +00:00
|
|
|
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') }
|
|
|
|
|
2024-09-12 13:31:50 +00:00
|
|
|
context 'when logged out' do
|
|
|
|
describe 'a local page for a remote account' do
|
|
|
|
it 'shows a confirmation page with relevant content' do
|
|
|
|
visit "/@#{account.pretty_acct}"
|
|
|
|
|
|
|
|
expect(page)
|
|
|
|
.to have_content(redirect_title) # Redirect explanation
|
|
|
|
.and have_link(account.url, href: account.url) # Appropriate account link
|
|
|
|
.and have_css('body', class: 'app-body')
|
|
|
|
end
|
|
|
|
end
|
2024-01-25 11:13:33 +00:00
|
|
|
|
2024-09-12 13:31:50 +00:00
|
|
|
describe 'a local page for a remote status' do
|
|
|
|
it 'shows a confirmation page with relevant content' do
|
|
|
|
visit "/@#{account.pretty_acct}/#{status.id}"
|
2024-01-25 11:13:33 +00:00
|
|
|
|
2024-09-12 13:31:50 +00:00
|
|
|
expect(page)
|
|
|
|
.to have_content(redirect_title) # Redirect explanation
|
|
|
|
.and have_link(status.url, href: status.url) # Appropriate status link
|
|
|
|
.and have_css('body', class: 'app-body')
|
|
|
|
end
|
2024-01-25 11:13:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-09-12 13:31:50 +00:00
|
|
|
def redirect_title
|
|
|
|
I18n.t('redirects.title', instance: 'cb6e6126.ngrok.io')
|
2024-01-25 11:13:33 +00:00
|
|
|
end
|
|
|
|
end
|