闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'about/_contact.html.haml' do
  4. describe 'the contact account', without_verify_partial_doubles: true do
  5. before do
  6. allow(view).to receive(:display_name).and_return('Display Name!')
  7. end
  8. it 'shows info when account is present' do
  9. account = Account.new(username: 'admin')
  10. contact = double(contact_account: account, site_contact_email: '')
  11. render 'about/contact', contact: contact
  12. expect(rendered).to have_content('@admin')
  13. end
  14. it 'does not show info when account is missing' do
  15. contact = double(contact_account: nil, site_contact_email: '')
  16. render 'about/contact', contact: contact
  17. expect(rendered).not_to have_content('@')
  18. end
  19. end
  20. describe 'the contact email' do
  21. it 'show info when email is present' do
  22. contact = double(site_contact_email: '[email protected]mple.com', contact_account: nil)
  23. render 'about/contact', contact: contact
  24. expect(rendered).to have_content('[email protected]')
  25. end
  26. it 'does not show info when email is missing' do
  27. contact = double(site_contact_email: nil, contact_account: nil)
  28. render 'about/contact', contact: contact
  29. expect(rendered).not_to have_content(I18n.t('about.business_email'))
  30. end
  31. end
  32. end