Skip to content

Commit 930ca40

Browse files
sdelanoSeth Falcon
authored andcommitted
MethodNotAllowed when modifying _default env
1 parent 8469a48 commit 930ca40

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

chef-server-api/app/controllers/environments.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def create
6060

6161
# PUT /environments/:id
6262
def update
63-
raise Forbidden if params[:id] == "_default"
63+
raise MethodNotAllowed if params[:id] == "_default"
6464
begin
6565
env = Chef::Environment.cdb_load(params[:id])
6666
rescue Chef::Exceptions::CouchDBNotFound
@@ -76,7 +76,7 @@ def update
7676

7777
# DELETE /environments/:id
7878
def destroy
79-
raise Forbidden if params[:id] == "_default"
79+
raise MethodNotAllowed if params[:id] == "_default"
8080
begin
8181
env = Chef::Environment.cdb_load(params[:id])
8282
rescue Chef::Exceptions::CouchDBNotFound

features/api/environments/delete_environment_api.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ Feature: Delete environments via the REST API
3030
Scenario Outline: Delete the '_default' environment
3131
Given I am <user_type>
3232
When I 'DELETE' the path '/environments/_default'
33-
Then I should get a '403 "Forbidden"' exception
33+
Then I should get a '<exception_type>' exception
3434

3535
Examples:
36-
| user_type |
37-
| an administrator |
38-
| a non-admin |
36+
| user_type | exception_type |
37+
| an administrator | 405 "Method Not Allowed" |
38+
| a non-admin | 403 "Forbidden" |

features/api/environments/update_environment_api.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ Feature: Update an environment via the REST API
4343
Given I am <user_type>
4444
And an 'environment' named 'cucumber'
4545
When I 'PUT' the 'environment' to the path '/environments/_default'
46-
Then I should get a '403 "Forbidden"' exception
46+
Then I should get a '<exception_type>' exception
4747

4848
Examples:
49-
| user_type |
50-
| an administrator |
51-
| a non-admin |
49+
| user_type | exception_type |
50+
| an administrator | 405 "Method Not Allowed" |
51+
| a non-admin | 403 "Forbidden" |

0 commit comments

Comments
 (0)