redirections_spec.rb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.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 logged out' do
  7. describe 'a local page for a remote account' do
  8. it 'shows a confirmation page with relevant content' do
  9. visit "/@#{account.pretty_acct}"
  10. expect(page)
  11. .to have_content(redirect_title) # Redirect explanation
  12. .and have_link(account.url, href: account.url) # Appropriate account link
  13. .and have_css('body', class: 'app-body')
  14. end
  15. end
  16. describe 'a local page for a remote status' do
  17. it 'shows a confirmation page with relevant content' do
  18. visit "/@#{account.pretty_acct}/#{status.id}"
  19. expect(page)
  20. .to have_content(redirect_title) # Redirect explanation
  21. .and have_link(status.url, href: status.url) # Appropriate status link
  22. .and have_css('body', class: 'app-body')
  23. end
  24. end
  25. end
  26. def redirect_title
  27. I18n.t('redirects.title', instance: 'cb6e6126.ngrok.io')
  28. end
  29. end