redirections_spec.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'redirection confirmations' do
  4. let(:account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/foo', url: 'https://example.com/@foo') }
  5. let(:status) { Fabricate(:status, account: account, uri: 'https://example.com/users/foo/statuses/1', url: 'https://example.com/@foo/1') }
  6. context 'when a logged out user visits a local page for a remote account' do
  7. it 'shows a confirmation page' do
  8. visit "/@#{account.pretty_acct}"
  9. # It explains about the redirect
  10. expect(page).to have_content(I18n.t('redirects.title', instance: 'cb6e6126.ngrok.io'))
  11. # It features an appropriate link
  12. expect(page).to have_link(account.url, href: account.url)
  13. end
  14. end
  15. context 'when a logged out user visits a local page for a remote status' do
  16. it 'shows a confirmation page' do
  17. visit "/@#{account.pretty_acct}/#{status.id}"
  18. # It explains about the redirect
  19. expect(page).to have_content(I18n.t('redirects.title', instance: 'cb6e6126.ngrok.io'))
  20. # It features an appropriate link
  21. expect(page).to have_link(status.url, href: status.url)
  22. end
  23. end
  24. end