diff --git a/spec/test/features/control/append/error_unprocessable.feature b/spec/test/features/control/append/error_unprocessable.feature index fdb0d15..6805625 100644 --- a/spec/test/features/control/append/error_unprocessable.feature +++ b/spec/test/features/control/append/error_unprocessable.feature @@ -3,7 +3,7 @@ Feature: Kapow! server reject responses with semantic errors. it receives a valid json document but not conforming with the specification. - Scenario: Error by lack of mandatory fields. + Scenario: Error because of lack of mandatory fields. If a request lacks of any of the mandatory fields the server responds with an error indicating the missing fields. @@ -18,7 +18,7 @@ Feature: Kapow! server reject responses with semantic errors. | missing_mandatory_fields | | "url_pattern", "method" | - Scenario: Error by wrong route spec. + Scenario: Error because of wrong route specification. If a request contains an invalid expression in the field url_pattern the server responds with an error. @@ -30,7 +30,7 @@ Feature: Kapow! server reject responses with semantic errors. And I get "Invalid Route Spec" as response phrase And I get an empty response body - Scenario: Error by wrong method value. + Scenario: Error because of wrong method value. If a request contains an invalid value in the field method the server responds with an error. diff --git a/spec/test/features/control/insert/error_unprocessable.feature b/spec/test/features/control/insert/error_unprocessable.feature index e69de29..9b01557 100644 --- a/spec/test/features/control/insert/error_unprocessable.feature +++ b/spec/test/features/control/insert/error_unprocessable.feature @@ -0,0 +1,44 @@ +Feature: Kapow! server reject insert responses with semantic errors. + Kapow! server will reject to insert routes when + it receives a valid json but not conforming document. + + Scenario: Error because of lack of mandatory fields. + If a request lacks of any of the mandatory fields + the server responds with an error indicating the + missing fields. + + Given I have a running Kapow! server + When I insert the route: + | entrypoint | command | + | /bin/sh -c | ls -la / \| response /body | + Then I get unprocessable entity as response code + And I get "Missing Mandatory Field" as response phrase + And I get the following entity as response body: + | missing_mandatory_fields | + | "url_pattern", "method" | + + Scenario: Error because of wrong route specification. + If a request contains an invalid expression in the + url_pattern field the server responds with an error. + + Given I have a running Kapow! server + When I insert the route: + | method | url_pattern | entrypoint | command | index | + | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | 0 | + Then I get unprocessable entity as response code + And I get "Invalid Route Spec" as response phrase + And I get an empty response body + + Scenario: Error because of wrong method value. + If a request contains an invalid value in the + method field the server responds with an error. + + Given I have a running Kapow! server + When I insert the route: + | method | url_pattern | entrypoint | command | index | + | AVECES | /listRootDir | /bin/sh -c | ls -la / \| response /body | 0 | + Then I get unprocessable entity as response code + And I get "Invalid Data Type" as response phrase + And I get an empty response body + +... diff --git a/spec/test/features/control/insert/success.feature b/spec/test/features/control/insert/success.feature index e69de29..4a2f2ff 100644 --- a/spec/test/features/control/insert/success.feature +++ b/spec/test/features/control/insert/success.feature @@ -0,0 +1,37 @@ +Feature: Insert new routes in Kapow! server. + Insert routes allow users to configure the server. New + routes could be inserted at the begining or before any + existing route of the routes list. + + Background: + Given I have a Kapow! server whith the following routes: + | method | url_pattern | entrypoint | command | + | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | + | GET | /listDir/{dirname} | /bin/sh -c | ls -la /request/params/dirname \| response /body | + + Scenario: Insert a route at the beginning. + A route can be inserted at the begining of the list + by specifying an index 0 in the request. + + When I insert the route: + | method | url_pattern | entrypoint | command | index | + | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | 0 | + Then I get ok as response code + And I get "OK" as response phrase + And I get the following entity as response body: + | method | url_pattern | entrypoint | command | index | id | + | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | 0 | * | + + Scenario: Insert a route in the middle. + A route can be inserted in the middle of the list + by specifying an index less or equal to the last + index in the request. + + When I insert the route: + | method | url_pattern | entrypoint | command | index | + | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | 1 | + Then I get ok as response code + And I get "OK" as response phrase + And I get the following entity as response body: + | method | url_pattern | entrypoint | command | index | id | + | GET | /listRootDir | /bin/sh -c | ls -la / \| response /body | 1 | * |