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.

55 lines
1.3 KiB

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Admin::AccountModerationNotesHelper, type: :helper do
  4. include AccountsHelper
  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