-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix admin permissions API endpoint and add test.
I'm not exactly sure what's going on, but this seems like it must have broken during some gem updates as part of the lua upgrade. The respond_with output is doing some odd things and the structure of the data being returned now isn't what's expected.
- Loading branch information
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/api-umbrella/web-app/spec/controllers/api/v1/admin_permissions_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require "spec_helper" | ||
|
||
describe Api::V1::AdminPermissionsController do | ||
before(:all) do | ||
@admin = FactoryGirl.create(:admin) | ||
end | ||
|
||
describe "GET index" do | ||
it "returns the expected permissions in the display order" do | ||
admin_token_auth(@admin) | ||
get :index, :format => "json" | ||
|
||
data = MultiJson.load(response.body) | ||
permission_names = data["admin_permissions"].map { |permission| permission["name"] } | ||
permission_names.should eql([ | ||
"Analytics", | ||
"API Users - View", | ||
"API Users - Manage", | ||
"Admin Accounts - View & Manage", | ||
"API Backend Configuration - View & Manage", | ||
"API Backend Configuration - Publish", | ||
]) | ||
|
||
data["admin_permissions"].first["id"].should eql("analytics") | ||
data["admin_permissions"].first["name"].should eql("Analytics") | ||
data["admin_permissions"].first["display_order"].should eql(1) | ||
end | ||
end | ||
end |