mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 17:31:12 +00:00
33 lines
773 B
Ruby
33 lines
773 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe Admin::Accounts::HeadersController do
|
|
render_views
|
|
|
|
before { sign_in current_user }
|
|
|
|
describe 'DELETE #destroy' do
|
|
subject { delete :destroy, params: { account_id: account.id } }
|
|
|
|
let(:current_user) { Fabricate(:user, role: role) }
|
|
let(:account) { Fabricate(:account) }
|
|
|
|
context 'when user is admin' do
|
|
let(:role) { UserRole.find_by(name: 'Admin') }
|
|
|
|
it 'succeeds in removing header' do
|
|
expect(subject).to redirect_to admin_account_path(account.id)
|
|
end
|
|
end
|
|
|
|
context 'when user is not admin' do
|
|
let(:role) { UserRole.everyone }
|
|
|
|
it 'fails to remove header' do
|
|
expect(subject).to have_http_status 403
|
|
end
|
|
end
|
|
end
|
|
end
|