privacy_policy_spec.rb 730 B

12345678910111213141516171819202122232425262728
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe PrivacyPolicy do
  4. describe '.current' do
  5. context 'with the default values' do
  6. it 'has the privacy text' do
  7. policy = described_class.current
  8. expect(policy.text).to eq(PrivacyPolicy::DEFAULT_PRIVACY_POLICY)
  9. end
  10. end
  11. context 'with a custom setting value' do
  12. before do
  13. terms_setting = instance_double(Setting, value: 'Terms text', updated_at: 10.days.ago)
  14. allow(Setting).to receive(:find_by).with(var: 'site_terms').and_return(terms_setting)
  15. end
  16. it 'has the privacy text' do
  17. policy = described_class.current
  18. expect(policy.text).to eq('Terms text')
  19. end
  20. end
  21. end
  22. end