Refactoring Article Tests

This commit is contained in:
2020-03-16 13:30:24 +01:00
parent ca78db4155
commit 0221d7023a
3 changed files with 50 additions and 61 deletions

View File

@@ -2,21 +2,27 @@
Feature: articles routes
Scenario: The route for get articles must response a 200
Given I have 3 article
When I send a GET request to "/articles"
Then the response status code should be 200
Scenario: Can get versions of article by the id
When I send a GET request to "/articles/9226c1a3-8091-c3fa-7d0d-c2e98c9bee7b/versions"
Given I have article
| id | 13e6091c-8fed-4600-b079-a97a6b7a9800 |
When I send a GET request to "/articles/13e6091c-8fed-4600-b079-a97a6b7a9800/versions"
Then the response status code should be 200
Scenario: The route for get one article must response a 200 and return article
When I send a GET request to "/articles/9226c1a3-8091-c3fa-7d0d-c2e98c9bee7b"
Given I have article
| id | 65cda9f3-8991-4420-8d41-1da9da72c9bb |
When I send a GET request to "/articles/65cda9f3-8991-4420-8d41-1da9da72c9bb"
Then the response status code should be 200
And the response should contain object:
| id | 9226c1a3-8091-c3fa-7d0d-c2e98c9bee7b |
| id | 65cda9f3-8991-4420-8d41-1da9da72c9bb |
Scenario: The route for create article must response a 200 and return object
Given I am authenticated as John Doe with id "64b7b379-2298-43ec-b428-ba134930cabd"
Given I have citizen John Doe
And I am authenticated as John Doe
When I send a POST request to "/articles" with body:
"""
{
@@ -27,10 +33,7 @@ Feature: articles routes
"description": "description2",
"tags": [
"green"
],
"created_by": {
"id": "64b7b379-2298-43ec-b428-ba134930cabd"
}
]
}
"""
Then the response status code should be 200