1
0

instance_helper_spec.rb 937 B

123456789101112131415161718192021222324252627282930313233343536373839
  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