~cytrogen/masto-fe

ref: 685270f3f7ea6d4a8a48ec641e8fdfd9fc2e2d7f masto-fe/spec/helpers/admin/account_moderation_notes_helper_spec.rb -rw-r--r-- 1.3 KiB
685270f3 — Claire [Glitch] Fix clicking “Explore” or “Live feeds” column headers to scroll in advanced mode 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Admin::AccountModerationNotesHelper do
  include AccountsHelper

  describe '#admin_account_link_to' do
    context 'when Account is nil' do
      let(:account) { nil }

      it 'returns nil' do
        expect(helper.admin_account_link_to(account)).to be_nil
      end
    end

    context 'with account' do
      let(:account) { Fabricate(:account) }

      it 'calls #link_to' do
        expect(helper).to receive(:link_to).with(
          admin_account_path(account.id),
          class: name_tag_classes(account),
          title: account.acct
        )

        helper.admin_account_link_to(account)
      end
    end
  end

  describe '#admin_account_inline_link_to' do
    context 'when Account is nil' do
      let(:account) { nil }

      it 'returns nil' do
        expect(helper.admin_account_inline_link_to(account)).to be_nil
      end
    end

    context 'with account' do
      let(:account) { Fabricate(:account) }

      it 'calls #link_to' do
        result = helper.admin_account_inline_link_to(account)

        expect(result).to match(name_tag_classes(account, true))
        expect(result).to match(account.acct)
        expect(result).to match(admin_account_path(account.id))
      end
    end
  end
end