闭社主体 forked from https://github.com/tootsuite/mastodon
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.

48 lines
1.3 KiB

  1. require 'rails_helper'
  2. describe ApplicationHelper do
  3. describe 'active_nav_class' do
  4. it 'returns active when on the current page' do
  5. allow(helper).to receive(:current_page?).and_return(true)
  6. result = helper.active_nav_class("/test")
  7. expect(result).to eq "active"
  8. end
  9. it 'returns empty string when not on current page' do
  10. allow(helper).to receive(:current_page?).and_return(false)
  11. result = helper.active_nav_class("/test")
  12. expect(result).to eq ""
  13. end
  14. end
  15. describe 'show_landing_strip?', without_verify_partial_doubles: true do
  16. describe 'when signed in' do
  17. before do
  18. allow(helper).to receive(:user_signed_in?).and_return(true)
  19. end
  20. it 'does not show landing strip' do
  21. expect(helper.show_landing_strip?).to eq false
  22. end
  23. end
  24. describe 'when signed out' do
  25. before do
  26. allow(helper).to receive(:user_signed_in?).and_return(false)
  27. end
  28. it 'does not show landing strip on single user instance' do
  29. allow(helper).to receive(:single_user_mode?).and_return(true)
  30. expect(helper.show_landing_strip?).to eq false
  31. end
  32. it 'shows landing strip on multi user instance' do
  33. allow(helper).to receive(:single_user_mode?).and_return(false)
  34. expect(helper.show_landing_strip?).to eq true
  35. end
  36. end
  37. end
  38. end