mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:10:17 +08:00
586454bcf1
* DEV: Add a dedicated Admin::StaffController base controller The current parent(Admin:AdminController) for all admin-related controllers uses a filter that allows only staff(admin, moderator) users. This refactor makes Admin::AdminController filter for only admins as the name suggests and introduces a base controller dedicated for staff-related endpoints. * DEV: Set staff-only controllers parent to Admin::StaffController Refactor staff-only controllers to inherit newly introduced Admin::StaffController abstract controller. This conveys the purpose of the parent controller better unlike the previously used parent controller.
21 lines
487 B
Ruby
21 lines
487 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Admin::PluginsController do
|
|
|
|
it "is a subclass of StaffController" do
|
|
expect(Admin::PluginsController < Admin::StaffController).to eq(true)
|
|
end
|
|
|
|
context "while logged in as an admin" do
|
|
before do
|
|
sign_in(Fabricate(:admin))
|
|
end
|
|
|
|
it 'should return JSON' do
|
|
get "/admin/plugins.json"
|
|
expect(response.status).to eq(200)
|
|
expect(response.parsed_body.has_key?('plugins')).to eq(true)
|
|
end
|
|
end
|
|
end
|