brine-dsl 0.8.1 → 0.9.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.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/Gemfile.lock +24 -75
- data/Rakefile +5 -29
- data/brine-dsl.gemspec +3 -5
- data/feature_setup.rb +17 -0
- data/lib/brine/requester.rb +27 -2
- data/lib/brine/step_definitions/request_construction.rb +5 -0
- data/lib/brine/test_steps.rb +8 -2
- data/lib/brine/type_checks.rb +2 -1
- data/lib/brine/util.rb +13 -3
- metadata +6 -145
- data/.gitignore +0 -3
- data/.travis.yml +0 -11
- data/CHANGELOG.md +0 -170
- data/Guardfile +0 -12
- data/LICENSE +0 -21
- data/README.adoc +0 -29
- data/config/cucumber.yml +0 -2
- data/docs/build.gradle +0 -19
- data/docs/cookbook.html +0 -643
- data/docs/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/docs/gradle/wrapper/gradle-wrapper.properties +0 -6
- data/docs/gradlew +0 -172
- data/docs/gradlew.bat +0 -84
- data/docs/guide.html +0 -1220
- data/docs/index.html +0 -486
- data/docs/specs.html +0 -2066
- data/docs/src/cookbook.adoc +0 -160
- data/docs/src/guide.adoc +0 -524
- data/docs/src/index.adoc +0 -28
- data/docs/src/spec.erb +0 -121
- data/docs/src/specs.adoc +0 -37
- data/features/argument_transforms/boolean.feature +0 -37
- data/features/argument_transforms/datetime.feature +0 -45
- data/features/argument_transforms/integer.feature +0 -41
- data/features/argument_transforms/list.feature +0 -46
- data/features/argument_transforms/object.feature +0 -66
- data/features/argument_transforms/quoted.feature +0 -41
- data/features/argument_transforms/regex.feature +0 -40
- data/features/argument_transforms/template.feature +0 -46
- data/features/argument_transforms/whitespace.feature +0 -51
- data/features/assertions/is_a_valid.feature +0 -184
- data/features/assertions/is_empty.feature +0 -67
- data/features/assertions/is_equal_to.feature +0 -60
- data/features/assertions/is_including.feature +0 -34
- data/features/assertions/is_matching.feature +0 -35
- data/features/assertions/is_of_length.feature +0 -43
- data/features/assignment/parameter.feature +0 -20
- data/features/assignment/random.feature +0 -25
- data/features/assignment/response_attribute.feature +0 -33
- data/features/assignment/timestamp.feature +0 -33
- data/features/deprecations/replaced_with.feature +0 -53
- data/features/request_construction/basic.feature +0 -29
- data/features/request_construction/body.feature +0 -26
- data/features/request_construction/clearing.feature +0 -46
- data/features/request_construction/headers.feature +0 -94
- data/features/request_construction/params.feature +0 -60
- data/features/resource_cleanup/cleanup.feature +0 -86
- data/features/selectors/all.feature +0 -55
- data/features/selectors/any.feature +0 -48
- data/features/step_definitions/test_steps.rb +0 -5
- data/features/support/env.rb +0 -10
- data/tutorial/missing.feature +0 -5
- data/tutorial/post_matching.feature +0 -12
- data/tutorial/post_status.feature +0 -10
- data/tutorial/support/env.rb +0 -2
@@ -1,40 +0,0 @@
|
|
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)" |
|
@@ -1,46 +0,0 @@
|
|
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]" |
|
@@ -1,51 +0,0 @@
|
|
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"] |
|
@@ -1,184 +0,0 @@
|
|
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
|
@@ -1,67 +0,0 @@
|
|
1
|
-
Feature: Empty
|
2
|
-
It can be asserted that a value is empty.
|
3
|
-
|
4
|
-
Scenario: Assorted positive and negative assertions pass.
|
5
|
-
Given a file named "features/is_empty.feature" with:
|
6
|
-
"""
|
7
|
-
|
8
|
-
Feature: Assert emptiness for multiple types.
|
9
|
-
Scenario: Empty body is empty.
|
10
|
-
When the response body is assigned ``
|
11
|
-
Then the value of the response body is empty
|
12
|
-
|
13
|
-
Scenario: Whitespace-only body is empty.
|
14
|
-
When the response body is assigned:
|
15
|
-
\"\"\"
|
16
|
-
|
17
|
-
\"\"\"
|
18
|
-
Then the value of the response body is empty
|
19
|
-
|
20
|
-
Scenario: Empty string is empty.
|
21
|
-
When the response body is assigned `""`
|
22
|
-
Then the value of the response body is empty
|
23
|
-
|
24
|
-
Scenario: Non-empty string is not empty.
|
25
|
-
When the response body is assigned `blah`
|
26
|
-
Then the value of the response body is not empty
|
27
|
-
|
28
|
-
Scenario: Quoted whitespace is not empty.
|
29
|
-
When the response body is assigned `" "`
|
30
|
-
Then the value of the response body is not empty
|
31
|
-
|
32
|
-
Scenario: Empty arrays are empty.
|
33
|
-
When the response body is assigned `[]`
|
34
|
-
Then the value of the response body is empty
|
35
|
-
|
36
|
-
Scenario: Non-empty arrays are not empty.
|
37
|
-
When the response body is assigned `[[]]`
|
38
|
-
Then the value of the response body is not empty
|
39
|
-
|
40
|
-
Scenario: Empty objects are empty.
|
41
|
-
When the response body is assigned `{}`
|
42
|
-
Then the value of the response body is empty
|
43
|
-
|
44
|
-
Scenario: Non-empty objects are not empty.
|
45
|
-
When the response body is assigned `{"foo":{}}`
|
46
|
-
Then the value of the response body is not empty
|
47
|
-
|
48
|
-
Scenario: Null values are empty.
|
49
|
-
When the response body is assigned `{"foo": null}`
|
50
|
-
Then the value of the response body child `foo` is empty
|
51
|
-
|
52
|
-
Scenario: False is not empty.
|
53
|
-
When the response body is assigned `false`
|
54
|
-
Then the value of the response body is not empty
|
55
|
-
|
56
|
-
Scenario: 0 is not empty.
|
57
|
-
When the response body is assigned `0`
|
58
|
-
Then the value of the response body is not empty
|
59
|
-
|
60
|
-
"""
|
61
|
-
When I run `cucumber --strict features/is_empty.feature`
|
62
|
-
Then the output should contain:
|
63
|
-
"""
|
64
|
-
12 passed
|
65
|
-
"""
|
66
|
-
And it should pass
|
67
|
-
|
@@ -1,60 +0,0 @@
|
|
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 pass.
|
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
|