cucumber-rest-bdd 0.4.3.pre.114 → 0.4.3.pre.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/features/functional.feature +4 -0
- data/lib/cucumber-rest-bdd/steps/functional.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93175077c699396b4e75a1295d7cb826567880ce
|
|
4
|
+
data.tar.gz: 8db76a101bba221db09965af20afed9aff13a7c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 492ce4f20535eff2a9680235393ba5dd18ba74c9b379d64bedf6b62882b69736cc1e8d07ef786d8b9bdc43f32daa243a48483bad953df1e1cdd694551b4cff95
|
|
7
|
+
data.tar.gz: 52ca06b96cb58071aa67881cef0a9709f7fc2b3b2538573d760ffda3679c475980def5a04edae27e01934c8287c02c9900eac920ca4b9db4b3bdb73804cd6ea6
|
data/features/functional.feature
CHANGED
|
@@ -7,7 +7,11 @@ Feature: Performing different rest methods
|
|
|
7
7
|
When I request a list of posts with:
|
|
8
8
|
| User Id | 8 |
|
|
9
9
|
Then the request is successful
|
|
10
|
+
And the JSON response should have "$." of type array with at least 1 entry
|
|
11
|
+
And the JSON response should have "$." of type array with at least 10 entries
|
|
10
12
|
And the JSON response should have "$." of type array with 10 entries
|
|
13
|
+
And the JSON response should have "$." of type array with at most 10 entries
|
|
14
|
+
And the JSON response should have "$." of type array with at most 11 entries
|
|
11
15
|
|
|
12
16
|
Scenario: Check for null type
|
|
13
17
|
When I request to create a post with:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'cucumber-api/response'
|
|
2
2
|
require 'cucumber-api/steps'
|
|
3
|
+
require 'cucumber-rest-bdd/types'
|
|
3
4
|
|
|
4
5
|
Then(/^the response (?:should have|has a|has the) header "([^"]*)" with (?:a |the )?value "([^"]*)"$/) do |header, value|
|
|
5
6
|
p_value = resolve(value)
|
|
@@ -14,6 +15,12 @@ Then(/^the JSON response should have "([^"]*)" of type array with (\d+) entr(?:y
|
|
|
14
15
|
raise %/Expected #{number} items in array for path '#{json_path}', found: #{list.count}\n#{@response.to_json_s}/ if list.count != number.to_i
|
|
15
16
|
end
|
|
16
17
|
|
|
18
|
+
Then(/^the JSON response should have "([^"]*)" of type array with (#{FEWER_MORE_THAN}) (\d+) entr(?:y|ies)$/) do |json_path, count_mod, number|
|
|
19
|
+
list = @response.get_as_type json_path, 'array'
|
|
20
|
+
raise %/Expected #{count_mod} #{number} items in array for path '#{json_path}', found: #{list.count}\n#{@response.to_json_s}/ \
|
|
21
|
+
if !num_compare(count_mod, list.count, number.to_i)
|
|
22
|
+
end
|
|
23
|
+
|
|
17
24
|
Then(/^the JSON response should have "([^"]*)" of type (.+) that matches "(.+)"$/) do |json_path, type, regex|
|
|
18
25
|
value = @response.get_as_type json_path, type
|
|
19
26
|
raise %/Expected #{json_path} value '#{value}' to match regex: #{regex}\n#{@response.to_json_s}/ if (Regexp.new(regex) =~ value).nil?
|