mirror of
https://github.com/mastodon/mastodon
synced 2024-11-24 15:16:19 +09:00
Spec Admin::BaseController (#3328)
This commit is contained in:
parent
4b11675bdc
commit
019f3377bb
26
spec/controllers/admin/base_controller_spec.rb
Normal file
26
spec/controllers/admin/base_controller_spec.rb
Normal file
@ -0,0 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe Admin::BaseController, type: :controller do
|
||||
controller do
|
||||
def success
|
||||
render 'admin/reports/show'
|
||||
end
|
||||
end
|
||||
|
||||
it 'renders admin layout' do
|
||||
routes.draw { get 'success' => 'admin/base#success' }
|
||||
sign_in(Fabricate(:user, admin: true))
|
||||
get :success
|
||||
expect(response).to render_template layout: 'admin'
|
||||
end
|
||||
|
||||
it 'requires administrator' do
|
||||
routes.draw { get 'success' => 'admin/base#success' }
|
||||
sign_in(Fabricate(:user, admin: false))
|
||||
get :success
|
||||
|
||||
expect(response).to redirect_to('/')
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user