mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-21 16:48:33 +00:00
56 lines
1.3 KiB
Ruby
56 lines
1.3 KiB
Ruby
# 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
|
|
allow(helper).to receive(:link_to)
|
|
|
|
helper.admin_account_link_to(account)
|
|
|
|
expect(helper).to have_received(:link_to).with(
|
|
admin_account_path(account.id),
|
|
class: name_tag_classes(account),
|
|
title: account.acct
|
|
)
|
|
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
|