-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df5b7b7
commit 9f6a31a
Showing
4 changed files
with
141 additions
and
32 deletions.
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
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
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
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 |
---|---|---|
@@ -1,8 +1,101 @@ | ||
Feature: Check that ResponseTrait works | ||
|
||
Scenario: Assert header response | ||
Scenario: Assert "Then the response should contain the header :header_name" works | ||
Given I go to "/" | ||
And response contains header "Content-Type" | ||
And response does not contain header "NotExistingHeader" | ||
And response header "Content-Type" contains "text/html; charset=utf-8" | ||
And response header "Content-Type" does not contain "NotExistingHeaderValue" | ||
Then the response should contain the header "Content-Type" | ||
|
||
@trait:ResponseTrait | ||
Scenario: Assert that negative assertion for "Then the response should contain the header :header_name" fails with an error | ||
Given some behat configuration | ||
And scenario steps: | ||
""" | ||
Given I go to "/" | ||
Then the response should contain the header "NonExistingHeader" | ||
""" | ||
When I run "behat --no-colors" | ||
Then it should fail with an error: | ||
""" | ||
The response does not contain the header "NonExistingHeader". | ||
""" | ||
|
||
Scenario: Assert "Then the response should not contain the header :header_name" works | ||
Given I go to "/" | ||
Then the response should not contain the header "NonExistingHeader" | ||
|
||
@trait:ResponseTrait | ||
Scenario: Assert that negative assertion for "Then the response should not contain the header :header_name" fails with an error | ||
Given some behat configuration | ||
And scenario steps: | ||
""" | ||
Given I go to "/" | ||
Then the response should not contain the header "Content-Type" | ||
""" | ||
When I run "behat --no-colors" | ||
Then it should fail with an error: | ||
""" | ||
The response contains the header "Content-Type", but should not. | ||
""" | ||
|
||
Scenario: Assert "Then the response header :header_name should contain the value :header_value" works | ||
Given I go to "/" | ||
Then the response header "Content-Type" should contain the value "text/html; charset=utf-8" | ||
|
||
@trait:ResponseTrait | ||
Scenario: Assert that negative assertion for "Then the response header :header_name should contain the value :header_value" fails with an exception for missing header | ||
Given some behat configuration | ||
And scenario steps: | ||
""" | ||
Given I go to "/" | ||
Then the response header "NonExistingHeader" should contain the value "text/html; charset=utf-8" | ||
""" | ||
When I run "behat --no-colors" | ||
Then it should fail with an exception: | ||
""" | ||
The response does not contain the header "NonExistingHeader". | ||
""" | ||
|
||
@trait:ResponseTrait | ||
Scenario: Assert that negative assertion for "Then the response header :header_name should contain the value :header_value" fails with an error for invalid header value | ||
Given some behat configuration | ||
And scenario steps: | ||
""" | ||
Given I go to "/" | ||
Then the response header "Content-Type" should contain the value "nonexistingvalue" | ||
""" | ||
When I run "behat --no-colors" | ||
Then it should fail with a "Behat\Mink\Exception\ExpectationException" exception: | ||
""" | ||
The text "nonexistingvalue" was not found anywhere in the "Content-Type" response header. | ||
""" | ||
|
||
Scenario: Assert "Then the response header :header_name should not contain the value :header_value" works | ||
Given I go to "/" | ||
Then the response header "Content-Type" should not contain the value "nonexistingvalue" | ||
|
||
@trait:ResponseTrait | ||
Scenario: Assert that negative assertion for "Then the response header :header_name should not contain the value :header_value" fails with an exception for missing header | ||
Given some behat configuration | ||
And scenario steps: | ||
""" | ||
Given I go to "/" | ||
Then the response header "NonExistingHeader" should not contain the value "nonexistingvalue" | ||
""" | ||
When I run "behat --no-colors" | ||
Then it should fail with an exception: | ||
""" | ||
The response does not contain the header "NonExistingHeader". | ||
""" | ||
|
||
@trait:ResponseTrait | ||
Scenario: Assert that negative assertion for "Then the response header :header_name should not contain the value :header_value" fails with an error for invalid header value | ||
Given some behat configuration | ||
And scenario steps: | ||
""" | ||
Given I go to "/" | ||
Then the response header "Content-Type" should not contain the value "text/html; charset=utf-8" | ||
""" | ||
When I run "behat --no-colors" | ||
Then it should fail with a "Behat\Mink\Exception\ExpectationException" exception: | ||
""" | ||
The text "text/html; charset=utf-8" was found in the "Content-Type" response header, but it should not. | ||
""" |