brine-dsl 0.5.0

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.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +11 -0
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +123 -0
  7. data/Guardfile +12 -0
  8. data/LICENSE +21 -0
  9. data/README.md +137 -0
  10. data/Rakefile +32 -0
  11. data/brine-dsl.gemspec +32 -0
  12. data/config/cucumber.yml +2 -0
  13. data/docs/build.gradle +19 -0
  14. data/docs/cookbook.html +567 -0
  15. data/docs/gradle/wrapper/gradle-wrapper.jar +0 -0
  16. data/docs/gradle/wrapper/gradle-wrapper.properties +6 -0
  17. data/docs/gradlew +172 -0
  18. data/docs/gradlew.bat +84 -0
  19. data/docs/guide.html +1149 -0
  20. data/docs/index.html +472 -0
  21. data/docs/specs.html +1672 -0
  22. data/docs/src/cookbook.adoc +87 -0
  23. data/docs/src/guide.adoc +427 -0
  24. data/docs/src/index.adoc +16 -0
  25. data/docs/src/spec.erb +121 -0
  26. data/docs/src/specs.adoc +24 -0
  27. data/features/argument_transforms/boolean.feature +37 -0
  28. data/features/argument_transforms/datetime.feature +45 -0
  29. data/features/argument_transforms/integer.feature +41 -0
  30. data/features/argument_transforms/list.feature +46 -0
  31. data/features/argument_transforms/object.feature +66 -0
  32. data/features/argument_transforms/quoted.feature +41 -0
  33. data/features/argument_transforms/regex.feature +40 -0
  34. data/features/argument_transforms/template.feature +46 -0
  35. data/features/argument_transforms/whitespace.feature +51 -0
  36. data/features/assertions/is_a_valid.feature +184 -0
  37. data/features/assertions/is_equal_to.feature +60 -0
  38. data/features/assertions/is_including.feature +29 -0
  39. data/features/assertions/is_matching.feature +35 -0
  40. data/features/deprecations/replaced_with.feature +35 -0
  41. data/features/request_construction/basic.feature +29 -0
  42. data/features/request_construction/body.feature +26 -0
  43. data/features/request_construction/clearing.feature +46 -0
  44. data/features/request_construction/headers.feature +94 -0
  45. data/features/request_construction/params.feature +60 -0
  46. data/features/resource_cleanup/cleanup.feature +86 -0
  47. data/features/selectors/all.feature +55 -0
  48. data/features/selectors/any.feature +48 -0
  49. data/features/step_definitions/test_steps.rb +5 -0
  50. data/features/support/env.rb +10 -0
  51. data/lib/brine/cleaner_upper.rb +62 -0
  52. data/lib/brine/coercer.rb +18 -0
  53. data/lib/brine/hooks.rb +4 -0
  54. data/lib/brine/mustache_binder.rb +25 -0
  55. data/lib/brine/requester.rb +125 -0
  56. data/lib/brine/rest_steps.rb +138 -0
  57. data/lib/brine/selector.rb +66 -0
  58. data/lib/brine/step_definitions/assertions.rb +37 -0
  59. data/lib/brine/step_definitions/assignment.rb +13 -0
  60. data/lib/brine/step_definitions/cleanup.rb +4 -0
  61. data/lib/brine/step_definitions/request_construction.rb +19 -0
  62. data/lib/brine/step_definitions/selection.rb +37 -0
  63. data/lib/brine/test_steps.rb +138 -0
  64. data/lib/brine/transforms.rb +81 -0
  65. data/lib/brine/type_checks.rb +35 -0
  66. data/lib/brine/util.rb +35 -0
  67. data/lib/brine.rb +39 -0
  68. data/tutorial/missing.feature +5 -0
  69. data/tutorial/post_matching.feature +12 -0
  70. data/tutorial/post_status.feature +10 -0
  71. data/tutorial/support/env.rb +2 -0
  72. metadata +306 -0
@@ -0,0 +1,37 @@
1
+ Feature: An argument that could represent a boolean value will be
2
+ transformed into a boolean type.
3
+
4
+ Scenario Outline: Assorted basic inputs are provided.
5
+ Given a file named "features/transform_boolean.feature" with:
6
+ """
7
+
8
+ Feature: Transform boolean arguments.
9
+ Scenario: Docstring simple value.
10
+ When the response body is assigned:
11
+ \"\"\"
12
+ <input>
13
+ \"\"\"
14
+ Then the response body as JSON is:
15
+ \"\"\"
16
+ '<expected>'
17
+ \"\"\"
18
+
19
+ Scenario: Inline simple value.
20
+ When the response body is assigned `<input>`
21
+ Then the response body as JSON is:
22
+ \"\"\"
23
+ '<expected>'
24
+ \"\"\"
25
+
26
+ """
27
+ When I run `cucumber --strict features/transform_boolean.feature`
28
+ Then the output should contain:
29
+ """
30
+ 2 passed
31
+ """
32
+ And it should pass
33
+
34
+ Examples:
35
+ | input | expected |
36
+ | true | true |
37
+ | false | false |
@@ -0,0 +1,45 @@
1
+ Feature: An argument that could represent a date/time value will be
2
+ transformed into a time type.
3
+
4
+ Scenario: Assorted basic inputs are provided.
5
+ Given a file named "features/transform_datetime.feature" with:
6
+ """
7
+
8
+ Feature: Transform date/time arguments.
9
+ Scenario: Docstring datetime is serialized properly.
10
+ When the response body is assigned:
11
+ \"\"\"
12
+ 2017-01-01T09:00:00Z
13
+ \"\"\"
14
+ Then the response body as JSON is:
15
+ \"\"\"
16
+ '"2017-01-01 09:00:00 UTC"'
17
+ \"\"\"
18
+
19
+ Scenario: Inline datetime is serialized properly.
20
+ When the response body is assigned `2017-01-01T09:00:00Z`
21
+ Then the response body as JSON is:
22
+ \"\"\"
23
+ '"2017-01-01 09:00:00 UTC"'
24
+ \"\"\"
25
+
26
+ Scenario: Value Comparison
27
+ When `now` is assigned a timestamp
28
+ And `then` is assigned `2017-01-01T12:00:00Z`
29
+ Then the value of `{{then}}` is less than `{{now}}`
30
+
31
+ Scenario: Child Comparison
32
+ When `now` is assigned a timestamp
33
+ And the response body is assigned:
34
+ \"\"\"
35
+ {"my_timestamp": "{{now}}"}
36
+ \"\"\"
37
+ Then the value of the response body child `my_timestamp` is greater than `2017-01-01T12:00:00Z`
38
+
39
+ """
40
+ When I run `cucumber --strict features/transform_datetime.feature`
41
+ Then the output should contain:
42
+ """
43
+ 4 passed
44
+ """
45
+ And it should pass
@@ -0,0 +1,41 @@
1
+ Feature: An argument that could represent an integer will be
2
+ transformed into an integer type.
3
+
4
+ Scenario Outline: Assorted basic inputs are provided.
5
+ Given a file named "features/transform_integer.feature" with:
6
+ """
7
+
8
+ Feature: Transform integer arguments.
9
+ Scenario: Docstring simple value.
10
+ When the response body is assigned:
11
+ \"\"\"
12
+ <input>
13
+ \"\"\"
14
+ Then the response body as JSON is:
15
+ \"\"\"
16
+ '<expected>'
17
+ \"\"\"
18
+
19
+ Scenario: Inline simple value.
20
+ When the response body is assigned `<input>`
21
+ Then the response body as JSON is:
22
+ \"\"\"
23
+ '<expected>'
24
+ \"\"\"
25
+
26
+ """
27
+ When I run `cucumber --strict features/transform_integer.feature`
28
+ Then the output should contain:
29
+ """ar
30
+ 2 passed
31
+ """
32
+ And it should pass
33
+
34
+ Examples:
35
+ | input | expected |
36
+ | 0 | 0 |
37
+ | -0 | 0 |
38
+ | 10 | 10 |
39
+ | -10 | -10 |
40
+ | 123456789123456789 | 123456789123456789 |
41
+ | -123456789123456789 | -123456789123456789 |
@@ -0,0 +1,46 @@
1
+ Feature: An argument that could represent a JSON list will be
2
+ transformed into a list whose elements will be also be transformed.
3
+
4
+ Scenario Outline: Assorted basic inputs are provided.
5
+ Given a file named "features/transform_list.feature" with:
6
+ """
7
+
8
+ Feature: Transform list arguments.
9
+ Scenario: Docstring simple list.
10
+ When the response body is assigned:
11
+ \"\"\"
12
+ <input>
13
+ \"\"\"
14
+ Then the response body as JSON is:
15
+ \"\"\"
16
+ '<expected>'
17
+ \"\"\"
18
+
19
+ Scenario: Inline simple list.
20
+ When the response body is assigned `<input>`
21
+ Then the response body as JSON is:
22
+ \"\"\"
23
+ '<expected>'
24
+ \"\"\"
25
+
26
+ """
27
+ When I run `cucumber --strict features/transform_list.feature`
28
+ Then the output should contain:
29
+ """
30
+ 2 passed
31
+ """
32
+ And it should pass
33
+
34
+ Examples:
35
+ | input | expected |
36
+ | [] | [] |
37
+ | ["a", "b"] | ["a","b"] |
38
+ | ["a" , "b" ] | ["a","b"] |
39
+ | [" a", " b "] | [" a"," b "] |
40
+ | [true, "false"] | [true,"false"] |
41
+ | [1,-3,"-5"] | [1,-3,"-5"] |
42
+ | ["foo,bar","baz"] | ["foo,bar","baz"] |
43
+ | ["foo,bar,baz"] | ["foo,bar,baz"] |
44
+ | ["foo\\"","bar"] | ["foo\\"","bar"] |
45
+ | ["fo\\"o\\",bar","baz"] | ["fo\\"o\\",bar","baz"] |
46
+ | [{"i":1},{"i":2}, "h"] | [{"i":1},{"i":2},"h"] |
@@ -0,0 +1,66 @@
1
+ Feature: An argument that could represent a JSON object will be
2
+ transformed into an object whose elements will also be transformed.
3
+
4
+ Scenario Outline: Assorted basic inputs are provided.
5
+ Given a file named "features/transform_object.feature" with:
6
+ """
7
+
8
+ Feature: Transform object arguments.
9
+ Scenario: Docstring simple object.
10
+ When the response body is assigned:
11
+ \"\"\"
12
+ <input>
13
+ \"\"\"
14
+ Then the response body as JSON is:
15
+ \"\"\"
16
+ '<expected>'
17
+ \"\"\"
18
+
19
+ Scenario: Inline simple object.
20
+ When the response body is assigned `<input>`
21
+ Then the response body as JSON is:
22
+ \"\"\"
23
+ '<expected>'
24
+ \"\"\"
25
+
26
+ """
27
+ When I run `cucumber features/transform_object.feature`
28
+ Then the output should contain:
29
+ """
30
+ 2 passed
31
+ """
32
+ And it should pass
33
+
34
+ Examples:
35
+ | input | expected |
36
+ | {} | {} |
37
+ | {"a":1} | {"a":1} |
38
+ | {"foo":"bar", "num":1, "list": ["1", 2, true]} | {"foo":"bar","num":1,"list":["1",2,true]} |
39
+ | {"foo": {"bar":{ "num":1, "list": ["1", 2, true]}}} | {"foo":{"bar":{"num":1,"list":["1",2,true]}}} |
40
+ | {"foo": "\"list\": [\"1\", 2, true]"} | {"foo":"\\"list\\": [\\"1\\", 2, true]"} |
41
+
42
+ Scenario: Passed an Object split over multiple lines
43
+ Given a file named "features/transform_object_splitline.feature" with:
44
+ """
45
+
46
+ Feature: Using an object argument split over multiple lines
47
+ Scenario: Object split over lines
48
+ When the response body is assigned:
49
+ \"\"\"
50
+ {
51
+ "foo":"bar"
52
+ }
53
+ \"\"\"
54
+ Then the value of the response body is equal to:
55
+ \"\"\"
56
+ {"foo":"bar"}
57
+ \"\"\"
58
+
59
+ """
60
+ When I run `cucumber --strict features/transform_object_splitline.feature`
61
+ Then the output should contain:
62
+ """
63
+ 1 passed
64
+ """
65
+ And it should pass
66
+
@@ -0,0 +1,41 @@
1
+ Feature: An argument that is quoted will be (not) transformed into
2
+ into a string, regardless of any more specific data type the
3
+ quoted value may resemble.
4
+
5
+ Scenario Outline: Assorted basic inputs are provided.
6
+ Given a file named "features/transform_quoted.feature" with:
7
+ """
8
+
9
+ Feature: Transform quoted arguments.
10
+ Scenario: Docstring simple value.
11
+ When the response body is assigned:
12
+ \"\"\"
13
+ <input>
14
+ \"\"\"
15
+ Then the response body as JSON is:
16
+ \"\"\"
17
+ '<expected>'
18
+ \"\"\"
19
+
20
+ Scenario: Inline simple value.
21
+ When the response body is assigned `<input>`
22
+ Then the response body as JSON is:
23
+ \"\"\"
24
+ '<expected>'
25
+ \"\"\"
26
+
27
+ """
28
+ When I run `cucumber --strict features/transform_quoted.feature`
29
+ Then the output should contain:
30
+ """
31
+ 2 passed
32
+ """
33
+ And it should pass
34
+
35
+ Examples:
36
+ | input | expected |
37
+ | "true" | "true" |
38
+ | "123" | "123" |
39
+ | " -123 " | " -123 " |
40
+ | "["foo","bar"]" | "[\"foo\",\"bar\"]" |
41
+ | "{"foo":"bar"}" | "{\"foo\":\"bar\"}" |
@@ -0,0 +1,40 @@
1
+ Feature: An argument that is enclosed in slashes (/) will be transformed into a regex.
2
+
3
+ Scenario Outline: Assorted basic inputs are provided.
4
+ Given a file named "features/transform_regex.feature" with:
5
+ """
6
+
7
+ Feature: Tranform regex arguments.
8
+ Scenario: Docstring simple value.
9
+ When the response body is assigned:
10
+ \"\"\"
11
+ <input>
12
+ \"\"\"
13
+ Then the response body as JSON is:
14
+ \"\"\"
15
+ '<expected>'
16
+ \"\"\"
17
+
18
+ Scenario: Inline simple value.
19
+ When the response body is assigned `<input>`
20
+ Then the response body as JSON is:
21
+ \"\"\"
22
+ '<expected>'
23
+ \"\"\"
24
+
25
+ """
26
+ When I run `cucumber --strict features/transform_regex.feature`
27
+ Then the output should contain:
28
+ """
29
+ 2 passed
30
+ """
31
+ And it should pass
32
+
33
+ #Expecting Ruby stringification and using painful escaping
34
+ Examples:
35
+ | input | expected |
36
+ | // | "(?-mix:)" |
37
+ | /\// | "(?-mix:\\\\\\\\/)" |
38
+ | /.*/ | "(?-mix:.*)" |
39
+ | /"[[:alpha:]]?"/ | "(?-mix:\\\\"[[:alpha:]]?\\\\")" |
40
+ | /foo bar/ | "(?-mix:foo bar)" |
@@ -0,0 +1,46 @@
1
+ Feature: An argument that includes {{ }} interpolation markers will be
2
+ treated as a template and transformed into an evaluated version of
3
+ that template using the current binding environment which will then
4
+ also be transformed.
5
+
6
+ Scenario Outline: A single value template is expanded
7
+ using a simple bound value.
8
+ Given a file named "features/transform_template.feature" with:
9
+ """
10
+
11
+ Feature: Transform template arguments.
12
+ Background:
13
+ When `bound` is assigned `<binding>`
14
+
15
+ Scenario: Docstring single value template.
16
+ When the response body is assigned:
17
+ \"\"\"
18
+ {{{bound}}}
19
+ \"\"\"
20
+ Then the response body as JSON is:
21
+ \"\"\"
22
+ '<expected>'
23
+ \"\"\"
24
+ Scenario: Inline single value template.
25
+ When the response body is assigned `{{{bound}}}`
26
+ Then the response body as JSON is:
27
+ \"\"\"
28
+ '<expected>'
29
+ \"\"\"
30
+
31
+ """
32
+ When I run `cucumber --strict features/transform_template.feature`
33
+ Then the output should contain:
34
+ """
35
+ 6 passed
36
+ """
37
+ And it should pass
38
+
39
+ # Double quotes for quoted because it will be transformed on binding also
40
+ Examples:
41
+ | binding | expected |
42
+ | true | true |
43
+ | -452 | -452 |
44
+ | ""-452"" | "-452" |
45
+ | ["a", 1] | ["a",1] |
46
+ | ""["a", 1]"" | "[\\"a\\", 1]" |
@@ -0,0 +1,51 @@
1
+ Feature: An argument that includes leading or trailing whitespace
2
+ will be transformed so that such whitespace is removed
3
+ and that value will also be transformed.
4
+
5
+ Scenario Outline: Assorted basic inputs are provided.
6
+ Given a file named "features/transform_whitespace.feature" with:
7
+ """
8
+
9
+ Feature: Transform arguments with leading and/or trailing whitespace.
10
+ Scenario: Docstring simple value.
11
+ When the response body is assigned:
12
+ \"\"\"
13
+ <input>
14
+ \"\"\"
15
+ Then the response body as JSON is:
16
+ \"\"\"
17
+ '<expected>'
18
+ \"\"\"
19
+
20
+ Scenario: Inline simple value.
21
+ When the response body is assigned `<input>`
22
+ Then the response body as JSON is:
23
+ \"\"\"
24
+ '<expected>'
25
+ \"\"\"
26
+
27
+ Scenario: Docstring value with a leading and trailing line.
28
+ When the response body is assigned:
29
+ \"\"\"
30
+
31
+ <input>
32
+
33
+ \"\"\"
34
+ Then the response body as JSON is:
35
+ \"\"\"
36
+ '<expected>'
37
+ \"\"\"
38
+
39
+ """
40
+ When I run `cucumber --strict features/transform_whitespace.feature`
41
+ Then the output should contain:
42
+ """
43
+ 3 passed
44
+ """
45
+ And it should pass
46
+
47
+ Examples:
48
+ | input | expected |
49
+ | true | true |
50
+ | 123 | 123 |
51
+ | ["a"] | ["a"] |
@@ -0,0 +1,184 @@
1
+ Feature: A valid ...
2
+
3
+ Scenario: Positive and negative assertions for JSON types.
4
+ Given a file named "features/is_a_valid.feature" with:
5
+ """
6
+
7
+ Feature: Assert type validity
8
+ Scenario: String in response body is only a valid String.
9
+ When the response body is assigned:
10
+ \"\"\"
11
+ foo
12
+ \"\"\"
13
+ Then the value of the response body is a valid `String`
14
+ And the value of the response body is not a valid `Number`
15
+ And the value of the response body is not a valid `Integer`
16
+ And the value of the response body is not a valid `Object`
17
+ And the value of the response body is not a valid `Array`
18
+ And the value of the response body is not a valid `Boolean`
19
+
20
+ Scenario: Integer in response body is a valid Integer and Number.
21
+ When the response body is assigned:
22
+ \"\"\"
23
+ 1
24
+ \"\"\"
25
+ Then the value of the response body is not a valid `String`
26
+ And the value of the response body is a valid `Number`
27
+ And the value of the response body is a valid `Integer`
28
+ And the value of the response body is not a valid `Object`
29
+ And the value of the response body is not a valid `Array`
30
+ And the value of the response body is not a valid `Boolean`
31
+
32
+ Scenario: Quoted Number in response body is only a valid String.
33
+ When the response body is assigned:
34
+ \"\"\"
35
+ "1"
36
+ \"\"\"
37
+ Then the value of the response body is a valid `String`
38
+ And the value of the response body is not a valid `Number`
39
+ And the value of the response body is not a valid `Integer`
40
+ And the value of the response body is not a valid `Object`
41
+ And the value of the response body is not a valid `Array`
42
+ And the value of the response body is not a valid `Boolean`
43
+
44
+ Scenario: Empty Object in response body is only a valid Object.
45
+ When the response body is assigned:
46
+ \"\"\"
47
+ {}
48
+ \"\"\"
49
+ Then the value of the response body is not a valid `String`
50
+ And the value of the response body is not a valid `Number`
51
+ And the value of the response body is not a valid `Integer`
52
+ And the value of the response body is a valid `Object`
53
+ And the value of the response body is not a valid `Array`
54
+ And the value of the response body is not a valid `Boolean`
55
+
56
+ Scenario: Object in response body is only a valid Object.
57
+ When the response body is assigned:
58
+ \"\"\"
59
+ {"foo": 1}
60
+ \"\"\"
61
+ Then the value of the response body is not a valid `String`
62
+ And the value of the response body is not a valid `Number`
63
+ And the value of the response body is not a valid `Integer`
64
+ And the value of the response body is a valid `Object`
65
+ And the value of the response body is not a valid `Array`
66
+ And the value of the response body is not a valid `Boolean`
67
+
68
+ Scenario: Quoted Object in response body is only a valid String.
69
+ When the response body is assigned:
70
+ \"\"\"
71
+ "{"foo": 1}"
72
+ \"\"\"
73
+ Then the value of the response body is a valid `String`
74
+ And the value of the response body is not a valid `Number`
75
+ And the value of the response body is not a valid `Integer`
76
+ And the value of the response body is not a valid `Object`
77
+ And the value of the response body is not a valid `Array`
78
+ And the value of the response body is not a valid `Boolean`
79
+
80
+
81
+ Scenario: Empty Array in response body is only a valid Array.
82
+ When the response body is assigned:
83
+ \"\"\"
84
+ []
85
+ \"\"\"
86
+ Then the value of the response body is not a valid `String`
87
+ And the value of the response body is not a valid `Number`
88
+ And the value of the response body is not a valid `Integer`
89
+ And the value of the response body is not a valid `Object`
90
+ And the value of the response body is a valid `Array`
91
+ And the value of the response body is not a valid `Boolean`
92
+
93
+ Scenario: Array in response body is only a valid Array.
94
+ When the response body is assigned:
95
+ \"\"\"
96
+ [1, "foo"]
97
+ \"\"\"
98
+ Then the value of the response body is not a valid `String`
99
+ And the value of the response body is not a valid `Number`
100
+ And the value of the response body is not a valid `Integer`
101
+ And the value of the response body is not a valid `Object`
102
+ And the value of the response body is a valid `Array`
103
+ And the value of the response body is not a valid `Boolean`
104
+
105
+ Scenario: true in response body is only a valid Boolean.
106
+ When the response body is assigned:
107
+ \"\"\"
108
+ true
109
+ \"\"\"
110
+ Then the value of the response body is not a valid `String`
111
+ And the value of the response body is not a valid `Number`
112
+ And the value of the response body is not a valid `Integer`
113
+ And the value of the response body is not a valid `Object`
114
+ And the value of the response body is not a valid `Array`
115
+ And the value of the response body is a valid `Boolean`
116
+
117
+ Scenario: false in response body is only a valid Boolean.
118
+ When the response body is assigned:
119
+ \"\"\"
120
+ false
121
+ \"\"\"
122
+ Then the value of the response body is not a valid `String`
123
+ And the value of the response body is not a valid `Number`
124
+ And the value of the response body is not a valid `Integer`
125
+ And the value of the response body is not a valid `Object`
126
+ And the value of the response body is not a valid `Array`
127
+ And the value of the response body is a valid `Boolean`
128
+
129
+ Scenario: null in response body is not any valid type.
130
+ When the response body is assigned:
131
+ \"\"\"
132
+ [null]
133
+ \"\"\"
134
+ Then the value of the response body child `[0]` is not a valid `String`
135
+ And the value of the response body child `[0]` is not a valid `Number`
136
+ And the value of the response body child `[0]` is not a valid `Integer`
137
+ And the value of the response body child `[0]` is not a valid `Object`
138
+ And the value of the response body child `[0]` is not a valid `Array`
139
+ And the value of the response body child `[0]` is not a valid `Boolean`
140
+
141
+ Scenario: Selected Array child is a valid Array.
142
+ When the response body is assigned:
143
+ \"\"\"
144
+ {"val": [1, 2, 3]}
145
+ \"\"\"
146
+ Then the value of the response body child `val` is a valid `Array`
147
+
148
+ Scenario: Selected Array child member is a valid String.
149
+ When the response body is assigned:
150
+ \"\"\"
151
+ {"val": [1, 2, 3]}
152
+ \"\"\"
153
+ Then the value of the response body child `val[0]` is a valid `Number`
154
+ Then the value of the response body child `val[0]` is a valid `Integer`
155
+
156
+ Scenario: Selected nested children are a valid Array.
157
+ When the response body is assigned:
158
+ \"\"\"
159
+ [{"val": 1},{"val": 2}]
160
+ \"\"\"
161
+ Then the value of the response body children `.val` is a valid `Array`
162
+
163
+ Scenario: Selected nested children can be tested for type.
164
+ When the response body is assigned:
165
+ \"\"\"
166
+ [{"val": 1},{"val": 2}]
167
+ \"\"\"
168
+ Then the value of the response body children `.val` has elements which are all a valid `Number`
169
+ Then the value of the response body children `.val` has elements which are all a valid `Integer`
170
+
171
+ Scenario: Selected nested children can be tested for type when Arrays.
172
+ When the response body is assigned:
173
+ \"\"\"
174
+ [{"val": [1]},{"val": [2]}]
175
+ \"\"\"
176
+ Then the value of the response body children `.val` has elements which are all a valid `Array`
177
+
178
+ """
179
+ When I run `cucumber --strict features/is_a_valid.feature`
180
+ Then the output should contain:
181
+ """
182
+ 16 passed
183
+ """
184
+ And it should pass
@@ -0,0 +1,60 @@
1
+ Feature: Equal to
2
+ It can be asserted that a value is equal to another value
3
+
4
+ Scenario: Assorted positive and negative assertions.
5
+ Given a file named "features/is_equal_to.feature" with:
6
+ """
7
+
8
+ Feature: Assert value equality
9
+ Scenario: String in response body
10
+ When the response body is assigned:
11
+ \"\"\"
12
+ foo
13
+ \"\"\"
14
+ Then the value of the response body is equal to `foo`
15
+ And the value of the response body is not equal to `foot`
16
+
17
+ Scenario: Response Status
18
+ When the response status is assigned `404`
19
+ Then the value of the response status is equal to `404`
20
+ And the value of the response status is not equal to `200`
21
+
22
+ Scenario: Object in response body
23
+ When the response body is assigned:
24
+ \"\"\"
25
+ {
26
+ "foo": "bar"
27
+ }
28
+ \"\"\"
29
+ Then the value of the response body is equal to:
30
+ \"\"\"
31
+ {"foo":"bar"}
32
+ \"\"\"
33
+ And the value of the response body is not equal to:
34
+ \"\"\"
35
+ {"foo": "baz"}
36
+ \"\"\"
37
+
38
+ Scenario: List in response body
39
+ When the response body is assigned `[1, "foo", true]`
40
+ Then the value of the response body is equal to `[1, "foo", true]`
41
+ And the value of the response body is not equal to `[1, "bar", true]`
42
+
43
+ Scenario Outline: Objects must match completely
44
+ When the response body is assigned `{"foo": "bar", "baz": 1}`
45
+ Then the value of the response body is not equal to `<comparison>`
46
+
47
+ Examples:
48
+ | comparison |
49
+ | {} |
50
+ | {"foo": "bar"} |
51
+ | {"foo": "bar", "baz": 1, "extra": 2} |
52
+ | {"foo": "bar", "baz": 2} |
53
+
54
+ """
55
+ When I run `cucumber --strict features/is_equal_to.feature`
56
+ Then the output should contain:
57
+ """
58
+ 8 passed
59
+ """
60
+ And it should pass