Refactor cucumber steps

This commit is contained in:
2019-08-26 17:11:38 +02:00
parent 0e50921a0a
commit adba5a5aad
4 changed files with 49 additions and 39 deletions

View File

@@ -11,11 +11,7 @@ Feature: articles routes
| id | 9226c1a3-8091-c3fa-7d0d-c2e98c9bee7b |
Scenario: The route for create article must response a 200 and return object
Given I have citizen:
| id | 64b7b379-2298-43ec-b428-ba134930cabd |
| firstName | Jaque |
| lastName | Dupuis |
And I am authenticated as an user
Given I am authenticated as John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
When I send a POST request to "/articles" with body:
"""
{

View File

@@ -11,10 +11,7 @@ Feature: constitution routes
| id | 0ca489a6-ef68-8bd5-2355-5793d4b3d66c |
Scenario: The route for create constitution must response a 200 and return object
Given I have citizen:
| id | 64b7b379-2298-43ec-b428-ba134930cabd |
| firstName | Jaque |
| lastName | Dupuis |
Given I have citizen John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
When I send a POST request to "/constitutions" with body:
"""
{

View File

@@ -2,18 +2,12 @@ Feature: follow Article and Constitution
# Article
Scenario: The route for follow article must response a 201 and return object
Given I have citizen:
| id | 64b7b379-2298-43ec-b428-ba134930cabd |
| firstName | Jaque |
| lastName | Dupuis |
Given I have citizen John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
When I send a POST request to "/articles/9226c1a3-8091-c3fa-7d0d-c2e98c9bee7b/follow"
Then the response status code should be 201
Scenario: The route for get follows of articles must response a 200 and return objects
Given I have citizen:
| id | 64b7b379-2298-43ec-b428-ba134930cabd |
| firstName | Jaque |
| lastName | Dupuis |
Given I have citizen John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
When I send a GET request to "/citizens/64b7b379-2298-43ec-b428-ba134930cabd/follows/articles"
Then the response status code should be 200
And the response should contain object:
@@ -21,27 +15,18 @@ Feature: follow Article and Constitution
| limit | 50 |
Scenario: The route for unfollow article must response a 204
Given I have citizen:
| id | 64b7b379-2298-43ec-b428-ba134930cabd |
| firstName | Jaque |
| lastName | Dupuis |
Given I have citizen John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
When I send a DELETE request to "/articles/9226c1a3-8091-c3fa-7d0d-c2e98c9bee7b/follow"
Then the response status code should be 204
# Constitution
Scenario: The route for follow constitution must response a 201 and return object
Given I have citizen:
| id | 64b7b379-2298-43ec-b428-ba134930cabd |
| firstName | Jaque |
| lastName | Dupuis |
Given I have citizen John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
When I send a POST request to "/constitutions/72aa1ee1-4963-eb44-c9e0-5ce6e0f18f00/follow"
Then the response status code should be 201
Scenario: The route for get follows of constitutions must response a 200 and return objects
Given I have citizen:
| id | 64b7b379-2298-43ec-b428-ba134930cabd |
| firstName | Jaque |
| lastName | Dupuis |
Given I have citizen John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
When I send a GET request to "/citizens/64b7b379-2298-43ec-b428-ba134930cabd/follows/constitutions"
Then the response status code should be 200
And the response should contain object:
@@ -49,9 +34,6 @@ Feature: follow Article and Constitution
| limit | 50 |
Scenario: The route for unfollow constitution must response a 204
Given I have citizen:
| id | 64b7b379-2298-43ec-b428-ba134930cabd |
| firstName | Jaque |
| lastName | Dupuis |
Given I have citizen John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
When I send a DELETE request to "/constitutions/72aa1ee1-4963-eb44-c9e0-5ce6e0f18f00/follow"
Then the response status code should be 204