_contact.html.haml_spec.rb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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: 'admin@example.com', contact_account: nil)
  23. render 'about/contact', contact: contact
  24. expect(rendered).to have_content('admin@example.com')
  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