闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
605 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Admin::BaseController, type: :controller do
  4. controller do
  5. def success
  6. render 'admin/reports/show'
  7. end
  8. end
  9. it 'renders admin layout' do
  10. routes.draw { get 'success' => 'admin/base#success' }
  11. sign_in(Fabricate(:user, admin: true))
  12. get :success
  13. expect(response).to render_template layout: 'admin'
  14. end
  15. it 'requires administrator' do
  16. routes.draw { get 'success' => 'admin/base#success' }
  17. sign_in(Fabricate(:user, admin: false))
  18. get :success
  19. expect(response).to redirect_to('/')
  20. end
  21. end