account_moderation_notes_helper_spec.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Admin::AccountModerationNotesHelper, type: :helper do
  4. include StatusesHelper
  5. describe '#admin_account_link_to' do
  6. context 'account is nil' do
  7. let(:account) { nil }
  8. it 'returns nil' do
  9. expect(helper.admin_account_link_to(account)).to be_nil
  10. end
  11. end
  12. context 'with account' do
  13. let(:account) { Fabricate(:account) }
  14. it 'calls #link_to' do
  15. expect(helper).to receive(:link_to).with(
  16. admin_account_path(account.id),
  17. class: name_tag_classes(account),
  18. title: account.acct
  19. )
  20. helper.admin_account_link_to(account)
  21. end
  22. end
  23. end
  24. describe '#admin_account_inline_link_to' do
  25. context 'account is nil' do
  26. let(:account) { nil }
  27. it 'returns nil' do
  28. expect(helper.admin_account_inline_link_to(account)).to be_nil
  29. end
  30. end
  31. context 'with account' do
  32. let(:account) { Fabricate(:account) }
  33. it 'calls #link_to' do
  34. expect(helper).to receive(:link_to).with(
  35. admin_account_path(account.id),
  36. class: name_tag_classes(account, true),
  37. title: account.acct
  38. )
  39. helper.admin_account_inline_link_to(account)
  40. end
  41. end
  42. end
  43. end