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.

38 lines
1.1 KiB

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'about/_links.html.haml' do
  4. context 'when signed in' do
  5. before do
  6. allow(view).to receive(:user_signed_in?).and_return(true)
  7. end
  8. it 'does not show sign in link' do
  9. render 'about/links', instance: InstancePresenter.new
  10. expect(rendered).to have_content(I18n.t('about.get_started'))
  11. expect(rendered).not_to have_content(I18n.t('auth.login'))
  12. end
  13. end
  14. context 'when signed out' do
  15. before do
  16. allow(view).to receive(:user_signed_in?).and_return(false)
  17. end
  18. it 'shows get started link when registrations are allowed' do
  19. render 'about/links', instance: double(open_registrations: true)
  20. expect(rendered).to have_content(I18n.t('about.get_started'))
  21. expect(rendered).to have_content(I18n.t('auth.login'))
  22. end
  23. it 'hides get started link when registrations are closed' do
  24. render 'about/links', instance: double(open_registrations: false)
  25. expect(rendered).not_to have_content(I18n.t('about.get_started'))
  26. expect(rendered).to have_content(I18n.t('auth.login'))
  27. end
  28. end
  29. end