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.

39 lines
937 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe InstanceHelper do
  4. describe 'site_title' do
  5. around do |example|
  6. site_title = Setting.site_title
  7. example.run
  8. Setting.site_title = site_title
  9. end
  10. it 'Uses the Setting.site_title value when it exists' do
  11. Setting.site_title = 'New site title'
  12. expect(helper.site_title).to eq 'New site title'
  13. end
  14. it 'returns empty string when Setting.site_title is nil' do
  15. Setting.site_title = nil
  16. expect(helper.site_title).to eq 'cb6e6126.ngrok.io'
  17. end
  18. end
  19. describe 'site_hostname' do
  20. around(:each) do |example|
  21. before = Rails.configuration.x.local_domain
  22. example.run
  23. Rails.configuration.x.local_domain = before
  24. end
  25. it 'returns the local domain value' do
  26. Rails.configuration.x.local_domain = 'example.com'
  27. expect(helper.site_hostname).to eq 'example.com'
  28. end
  29. end
  30. end