2018-12-07 16:39:20 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-10-07 20:26:43 +02:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2023-05-04 05:49:53 +02:00
|
|
|
RSpec.describe Admin::AccountModerationNotesHelper do
|
2019-10-24 22:50:09 +02:00
|
|
|
include AccountsHelper
|
2018-12-07 16:39:20 +01:00
|
|
|
|
|
|
|
describe '#admin_account_link_to' do
|
2023-05-04 05:49:08 +02:00
|
|
|
context 'when Account is nil' do
|
2018-12-07 16:39:20 +01:00
|
|
|
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
|
2023-11-07 10:46:28 +01:00
|
|
|
allow(helper).to receive(:link_to)
|
|
|
|
|
|
|
|
helper.admin_account_link_to(account)
|
|
|
|
|
|
|
|
expect(helper).to have_received(:link_to).with(
|
2018-12-07 16:39:20 +01:00
|
|
|
admin_account_path(account.id),
|
|
|
|
class: name_tag_classes(account),
|
|
|
|
title: account.acct
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#admin_account_inline_link_to' do
|
2023-05-04 05:49:08 +02:00
|
|
|
context 'when Account is nil' do
|
2018-12-07 16:39:20 +01:00
|
|
|
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
|
2023-03-04 16:58:11 +01:00
|
|
|
result = helper.admin_account_inline_link_to(account)
|
2018-12-07 16:39:20 +01:00
|
|
|
|
2023-03-04 16:58:11 +01:00
|
|
|
expect(result).to match(name_tag_classes(account, true))
|
|
|
|
expect(result).to match(account.acct)
|
|
|
|
expect(result).to match(admin_account_path(account.id))
|
2018-12-07 16:39:20 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-10-07 20:26:43 +02:00
|
|
|
end
|