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,34 +0,0 @@
|
|
1
|
-
Feature: Including
|
2
|
-
It can be asserted that a value is a superset of another value.
|
3
|
-
|
4
|
-
Scenario: Includes
|
5
|
-
Given a file named "features/includes.feature" with:
|
6
|
-
"""
|
7
|
-
|
8
|
-
Feature: Includes
|
9
|
-
Scenario: Basic object membership
|
10
|
-
When the response body is assigned:
|
11
|
-
\"\"\"
|
12
|
-
{"foo":"bar",
|
13
|
-
"baz": 1,
|
14
|
-
"other": "blah"}
|
15
|
-
\"\"\"
|
16
|
-
Then the value of the response body is including:
|
17
|
-
\"\"\"
|
18
|
-
{"baz":1}
|
19
|
-
\"\"\"
|
20
|
-
And the value of the response body is not including:
|
21
|
-
\"\"\"
|
22
|
-
{"missing":"value"}
|
23
|
-
\"\"\"
|
24
|
-
And the value of the response body is including `other`
|
25
|
-
And the value of the response body is not including `brother`
|
26
|
-
And the value of the response body is not including `value`
|
27
|
-
|
28
|
-
"""
|
29
|
-
When I run `cucumber features/includes.feature`
|
30
|
-
Then the output should contain:
|
31
|
-
"""
|
32
|
-
1 passed
|
33
|
-
"""
|
34
|
-
And it should pass
|
@@ -1,35 +0,0 @@
|
|
1
|
-
Feature: Matching
|
2
|
-
It can be asserted that a value matches another string or regex.
|
3
|
-
|
4
|
-
Scenario: Assorted positive and negative assertions.
|
5
|
-
Given a file named "features/is_matching.feature" with:
|
6
|
-
"""
|
7
|
-
|
8
|
-
Feature: Assert value matchiness.
|
9
|
-
Scenario: String in response body is matched against a regex.
|
10
|
-
When the response body is assigned:
|
11
|
-
\"\"\"
|
12
|
-
http://www.github.com?var=val
|
13
|
-
\"\"\"
|
14
|
-
Then the value of the response body is matching `/github/`
|
15
|
-
And the value of the response body is matching `/git.*\?.*=/`
|
16
|
-
And the value of the response body is not matching `/gh/`
|
17
|
-
And the value of the response body is not matching `/^github/`
|
18
|
-
|
19
|
-
Scenario: Regex in response body matched against a string
|
20
|
-
When the response body is assigned:
|
21
|
-
\"\"\"
|
22
|
-
/(.+)\1/
|
23
|
-
\"\"\"
|
24
|
-
Then the value of the response body is matching `blahblah`
|
25
|
-
And the value of the response body is matching `boo`
|
26
|
-
And the value of the response body is not matching `blah blah`
|
27
|
-
And the value of the response body is not matching `blah`
|
28
|
-
|
29
|
-
"""
|
30
|
-
When I run `cucumber --strict features/is_matching.feature`
|
31
|
-
Then the output should contain:
|
32
|
-
"""
|
33
|
-
2 passed
|
34
|
-
"""
|
35
|
-
And it should pass
|
@@ -1,43 +0,0 @@
|
|
1
|
-
Feature: Of Length
|
2
|
-
It can be asserted that a value has a provided length.
|
3
|
-
|
4
|
-
Scenario: Has Length
|
5
|
-
Given a file named "features/has_length.feature" with:
|
6
|
-
"""
|
7
|
-
|
8
|
-
Feature: Has Length
|
9
|
-
Scenario: String
|
10
|
-
When the response body is assigned:
|
11
|
-
\"\"\"
|
12
|
-
blah
|
13
|
-
\"\"\"
|
14
|
-
Then the value of the response body is of length `4`
|
15
|
-
|
16
|
-
Scenario: Array
|
17
|
-
When the response body is assigned:
|
18
|
-
\"\"\"
|
19
|
-
["foo", "blah"]
|
20
|
-
\"\"\"
|
21
|
-
Then the value of the response body is of length `2`
|
22
|
-
|
23
|
-
Scenario: Map
|
24
|
-
When the response body is assigned:
|
25
|
-
\"\"\"
|
26
|
-
{"foo": "blah"}
|
27
|
-
\"\"\"
|
28
|
-
Then the value of the response body is of length `1`
|
29
|
-
|
30
|
-
Scenario: Value without length attribute
|
31
|
-
When the response body is assigned:
|
32
|
-
\"\"\"
|
33
|
-
true
|
34
|
-
\"\"\"
|
35
|
-
Then the value of the response body is not of length `1`
|
36
|
-
|
37
|
-
"""
|
38
|
-
When I run `cucumber features/has_length.feature`
|
39
|
-
Then the output should contain:
|
40
|
-
"""
|
41
|
-
4 passed
|
42
|
-
"""
|
43
|
-
And it should pass
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Feature: A Parameter
|
2
|
-
An identifier can be assigned the value of the provided parameter.
|
3
|
-
|
4
|
-
Scenario: Parameter assignment.
|
5
|
-
Given a file named "features/parameter.feature" with:
|
6
|
-
"""
|
7
|
-
|
8
|
-
Feature: Parameter Assignment.
|
9
|
-
Scenario: Simple assignment.
|
10
|
-
Given `foo` is assigned `bar`
|
11
|
-
When the response body is assigned `{{ foo }}`
|
12
|
-
Then the value of the response body is equal to `bar`
|
13
|
-
|
14
|
-
"""
|
15
|
-
When I run `cucumber --strict features/parameter.feature`
|
16
|
-
Then the output should contain:
|
17
|
-
"""
|
18
|
-
1 passed
|
19
|
-
"""
|
20
|
-
And it should pass
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Feature: A Random String
|
2
|
-
An identifier can be assigned a random string with decent entropy.
|
3
|
-
|
4
|
-
Scenario: Random string assignment.
|
5
|
-
Given a file named "features/random.feature" with:
|
6
|
-
"""
|
7
|
-
|
8
|
-
Feature: Random Assignment.
|
9
|
-
Scenario: Several unique variables.
|
10
|
-
Given `v1` is assigned a random string
|
11
|
-
And `v2` is assigned a random string
|
12
|
-
And `v3` is assigned a random string
|
13
|
-
When the response body is assigned `[ "{{ v1 }}","{{ v2 }}","{{ v3 }}" ]`
|
14
|
-
Then the value of the response body does not have any element that is empty
|
15
|
-
And the value of the response body child `.[0]` is equal to `{{ v1 }}`
|
16
|
-
And the value of the response body children `.[1:2]` does not have any element that is equal to `{{ v1 }}`
|
17
|
-
And the value of the response body child `.[2]` is not equal to `{{ v2 }}`
|
18
|
-
|
19
|
-
"""
|
20
|
-
When I run `cucumber --strict features/random.feature`
|
21
|
-
Then the output should contain:
|
22
|
-
"""
|
23
|
-
8 passed
|
24
|
-
"""
|
25
|
-
And it should pass
|
@@ -1,33 +0,0 @@
|
|
1
|
-
Feature: A Value From A Response Attribute.
|
2
|
-
An identifier can be assigned a value extracted from a response attribute.
|
3
|
-
|
4
|
-
Scenario: Assorted attribute extractions.
|
5
|
-
Given a file named "features/response_attribute.feature" with:
|
6
|
-
"""
|
7
|
-
|
8
|
-
Feature: Reponse Attribute Path Assignment.
|
9
|
-
Scenario: Response body.
|
10
|
-
Given the response body is assigned `foo`
|
11
|
-
When `myVar` is assigned the response body
|
12
|
-
And the response body is assigned `{{ myVar }}`
|
13
|
-
Then the value of the response body is equal to `foo`
|
14
|
-
|
15
|
-
Scenario: Response body child.
|
16
|
-
Given the response body is assigned `{"response": "foo"}`
|
17
|
-
When `myVar` is assigned the response body child `.response`
|
18
|
-
And the response body is assigned `{{ myVar }}`
|
19
|
-
Then the value of the response body is equal to `foo`
|
20
|
-
|
21
|
-
Scenario: Response body children.
|
22
|
-
Given the response body is assigned `{"response": "foo"}`
|
23
|
-
When `myVar` is assigned the response body children `.response`
|
24
|
-
And the response body is assigned `{{{ myVar }}}`
|
25
|
-
Then the value of the response body is equal to `["foo"]`
|
26
|
-
|
27
|
-
"""
|
28
|
-
When I run `cucumber --strict features/response_attribute.feature`
|
29
|
-
Then the output should contain:
|
30
|
-
"""
|
31
|
-
3 passed
|
32
|
-
"""
|
33
|
-
And it should pass
|
@@ -1,33 +0,0 @@
|
|
1
|
-
Feature: A Timestamp
|
2
|
-
An identifier can be assigned a current timestamp.
|
3
|
-
|
4
|
-
Scenario: Timestamp assignment.
|
5
|
-
Given a file named "features/timestamp.feature" with:
|
6
|
-
"""
|
7
|
-
|
8
|
-
Feature: Timestamp Assignment.
|
9
|
-
Scenario: Newer than some old date.
|
10
|
-
Given `v1` is assigned a timestamp
|
11
|
-
When the response body is assigned `{{ v1 }}`
|
12
|
-
Then value of the response body is greater than `2018-06-17T12:00:00Z`
|
13
|
-
|
14
|
-
Scenario: Values increase.
|
15
|
-
Given `v1` is assigned a timestamp
|
16
|
-
When the response body is assigned `{{ v1 }}`
|
17
|
-
Then the value of the response body is not empty
|
18
|
-
|
19
|
-
When `v2` is assigned a timestamp
|
20
|
-
And the response body is assigned `{{ v2 }}`
|
21
|
-
Then the value of the response body is greater than or equal to `{{ v1 }}`
|
22
|
-
|
23
|
-
When `v3` is assigned a timestamp
|
24
|
-
And the response body is assigned `{{ v3 }}`
|
25
|
-
Then the value of the response body is greater than or equal to `{{ v1 }}`
|
26
|
-
And the value of the response body is greater than or equal to `{{ v2 }}`
|
27
|
-
|
28
|
-
"""
|
29
|
-
When I run `cucumber --strict features/timestamp.feature`
|
30
|
-
Then the output should contain:
|
31
|
-
"""
|
32
|
-
2 passed
|
33
|
-
"""
|
@@ -1,53 +0,0 @@
|
|
1
|
-
Feature: Deprecation Messaging
|
2
|
-
|
3
|
-
Scenario: Deprecation Message is Displayed
|
4
|
-
Given a file named "features/deprecation.feature" with:
|
5
|
-
"""
|
6
|
-
Feature: Deprecation Messaging
|
7
|
-
Scenario: Multine String
|
8
|
-
When the response body is:
|
9
|
-
\"\"\"
|
10
|
-
Anything
|
11
|
-
\"\"\"
|
12
|
-
Then the response body as JSON is:
|
13
|
-
\"\"\"
|
14
|
-
""Anything""
|
15
|
-
\"\"\"
|
16
|
-
Scenario: Multine Object
|
17
|
-
When the response body is:
|
18
|
-
\"\"\"
|
19
|
-
{"isObj": true}
|
20
|
-
\"\"\"
|
21
|
-
Then the response body as JSON is:
|
22
|
-
\"\"\"
|
23
|
-
'{"isObj":true}'
|
24
|
-
\"\"\"
|
25
|
-
"""
|
26
|
-
When I run `cucumber features/deprecation.feature`
|
27
|
-
Then the output should contain:
|
28
|
-
"""
|
29
|
-
2 passed
|
30
|
-
"""
|
31
|
-
And the output should contain:
|
32
|
-
"""
|
33
|
-
DEPRECATION:
|
34
|
-
"""
|
35
|
-
And it should pass
|
36
|
-
|
37
|
-
Scenario: 0.9 depprecations
|
38
|
-
Given a file named "features/0.9.feature" with:
|
39
|
-
"""
|
40
|
-
|
41
|
-
Feature: 0.9
|
42
|
-
Scenario: includes the entries
|
43
|
-
When the response body is assigned `{"foo":"bar"}`
|
44
|
-
Then the response body includes the entries:
|
45
|
-
| foo | bar |
|
46
|
-
|
47
|
-
"""
|
48
|
-
When I run `cucumber --strict features/0.9.feature`
|
49
|
-
Then the output should contain:
|
50
|
-
"""
|
51
|
-
1 passed
|
52
|
-
"""
|
53
|
-
And it should pass
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Feature: Basic Request Construction
|
2
|
-
A simple request with a specified method and path can be sent.
|
3
|
-
|
4
|
-
Scenario Outline: Varying Methods
|
5
|
-
Given a file named "features/basic_requests.feature" with:
|
6
|
-
|
7
|
-
"""
|
8
|
-
Feature: Sending a method
|
9
|
-
Scenario: Basic URL
|
10
|
-
Given expected <method> sent to `/profile`
|
11
|
-
|
12
|
-
When a <method> is sent to `/profile`
|
13
|
-
Then expected calls are verified
|
14
|
-
"""
|
15
|
-
|
16
|
-
When I run `cucumber features/basic_requests.feature`
|
17
|
-
Then the output should contain:
|
18
|
-
"""
|
19
|
-
1 passed
|
20
|
-
"""
|
21
|
-
And it should pass
|
22
|
-
|
23
|
-
Examples:
|
24
|
-
| method |
|
25
|
-
| GET |
|
26
|
-
| POST |
|
27
|
-
| PATCH |
|
28
|
-
| DELETE |
|
29
|
-
| PUT |
|
@@ -1,26 +0,0 @@
|
|
1
|
-
Feature: Assigning a Request Body
|
2
|
-
|
3
|
-
Scenario: Request With Body
|
4
|
-
Given a file named "features/request_body.feature" with:
|
5
|
-
"""
|
6
|
-
Feature: Passing a body
|
7
|
-
Scenario: Basic URL
|
8
|
-
Given expected request body:
|
9
|
-
\"\"\"
|
10
|
-
{"request":1}
|
11
|
-
\"\"\"
|
12
|
-
And expected PUT sent to `/store`
|
13
|
-
|
14
|
-
When the request body is assigned:
|
15
|
-
\"\"\"
|
16
|
-
{"request":1}
|
17
|
-
\"\"\"
|
18
|
-
When a PUT is sent to `/store`
|
19
|
-
Then expected calls are verified
|
20
|
-
"""
|
21
|
-
When I run `cucumber features/request_body.feature`
|
22
|
-
Then the output should contain:
|
23
|
-
"""
|
24
|
-
5 passed
|
25
|
-
"""
|
26
|
-
And it should pass
|
@@ -1,46 +0,0 @@
|
|
1
|
-
Feature: Cleared After Sent
|
2
|
-
After a request is sent, any values that were added to that request
|
3
|
-
are cleared and will not be present in subsequent requests.
|
4
|
-
|
5
|
-
Scenario: Request is Cleared Before Second Send
|
6
|
-
Given a file named "features/request_clearing.feature" with:
|
7
|
-
|
8
|
-
"""
|
9
|
-
Feature: Clearing the request.
|
10
|
-
Scenario: Request body is cleared.
|
11
|
-
Given expected request body:
|
12
|
-
\"\"\"
|
13
|
-
{"request":1}
|
14
|
-
\"\"\"
|
15
|
-
And expected PUT sent to `/profile`
|
16
|
-
Given expected request body:
|
17
|
-
\"\"\"
|
18
|
-
\"\"\"
|
19
|
-
And expected PUT sent to `/store`
|
20
|
-
|
21
|
-
When the request body is assigned:
|
22
|
-
\"\"\"
|
23
|
-
{"request":1}
|
24
|
-
\"\"\"
|
25
|
-
And a PUT is sent to `/profile`
|
26
|
-
And a PUT is sent to `/store`
|
27
|
-
|
28
|
-
Then expected calls are verified
|
29
|
-
|
30
|
-
Scenario: Request parameter
|
31
|
-
Given expected GET sent to `/query?foo=bar`
|
32
|
-
And expected GET sent to `/resource`
|
33
|
-
|
34
|
-
Given the request query parameter `foo` is assigned `bar`
|
35
|
-
And a GET is sent to `/query`
|
36
|
-
|
37
|
-
When a GET is sent to `/resource`
|
38
|
-
Then expected calls are verified
|
39
|
-
"""
|
40
|
-
|
41
|
-
When I run `cucumber features/request_clearing.feature`
|
42
|
-
Then the output should contain:
|
43
|
-
"""
|
44
|
-
2 passed
|
45
|
-
"""
|
46
|
-
And it should pass
|
@@ -1,94 +0,0 @@
|
|
1
|
-
Feature: Adding Headers
|
2
|
-
|
3
|
-
Scenario: Headers are added to requests.
|
4
|
-
Given a file named "features/headers.feature" with:
|
5
|
-
|
6
|
-
"""
|
7
|
-
Feature: Request headers can be specified.
|
8
|
-
Scenario: A new header with a single value is added to request.
|
9
|
-
Given expected request headers:
|
10
|
-
\"\"\"
|
11
|
-
{"foo":"bar"}
|
12
|
-
\"\"\"
|
13
|
-
And expected GET sent to `/query`
|
14
|
-
|
15
|
-
When the request header `foo` is assigned `bar`
|
16
|
-
And a GET is sent to `/query`
|
17
|
-
|
18
|
-
Then expected calls are verified
|
19
|
-
|
20
|
-
Scenario: Default headers are present in requests.
|
21
|
-
Given expected request headers:
|
22
|
-
\"\"\"
|
23
|
-
{"Content-Type": "application/json"}
|
24
|
-
\"\"\"
|
25
|
-
And expected GET sent to `/query`
|
26
|
-
|
27
|
-
When a GET is sent to `/query`
|
28
|
-
|
29
|
-
Then expected calls are verified
|
30
|
-
|
31
|
-
Scenario: Default headers can be overridden.
|
32
|
-
Given expected request headers:
|
33
|
-
\"\"\"
|
34
|
-
{"Content-Type": "text/plain"}
|
35
|
-
\"\"\"
|
36
|
-
And expected GET sent to `/query`
|
37
|
-
|
38
|
-
When the request header `Content-Type` is assigned `text/plain`
|
39
|
-
And a GET is sent to `/query`
|
40
|
-
|
41
|
-
Then expected calls are verified
|
42
|
-
|
43
|
-
Scenario: Array header values are added to requests.
|
44
|
-
Given expected request headers:
|
45
|
-
\"\"\"
|
46
|
-
{"X-Array": "1, 2, 3"}
|
47
|
-
\"\"\"
|
48
|
-
And expected GET sent to `/query`
|
49
|
-
|
50
|
-
When the request header `X-Array` is assigned `[1, 2, 3]`
|
51
|
-
And a GET is sent to `/query`
|
52
|
-
|
53
|
-
Then expected calls are verified
|
54
|
-
|
55
|
-
Scenario: The last set value for a given header wins.
|
56
|
-
Given expected request headers:
|
57
|
-
\"\"\"
|
58
|
-
{"foo":"baz"}
|
59
|
-
\"\"\"
|
60
|
-
And expected GET sent to `/query`
|
61
|
-
|
62
|
-
When the request header `foo` is assigned `bar`
|
63
|
-
And the request header `foo` is assigned `baz`
|
64
|
-
And a GET is sent to `/query`
|
65
|
-
|
66
|
-
Then expected calls are verified
|
67
|
-
|
68
|
-
Scenario Outline: Header is added regardless of HTTP method.
|
69
|
-
Given expected request headers:
|
70
|
-
\"\"\"
|
71
|
-
{"foo":"bar"}
|
72
|
-
\"\"\"
|
73
|
-
And expected <method> sent to `/query`
|
74
|
-
|
75
|
-
When the request header `foo` is assigned `bar`
|
76
|
-
And a <method> is sent to `/query`
|
77
|
-
|
78
|
-
Then expected calls are verified
|
79
|
-
|
80
|
-
Examples:
|
81
|
-
| method |
|
82
|
-
| POST |
|
83
|
-
| PUT |
|
84
|
-
| DELETE |
|
85
|
-
| HEAD |
|
86
|
-
| OPTIONS |
|
87
|
-
"""
|
88
|
-
|
89
|
-
When I run `cucumber features/headers.feature`
|
90
|
-
Then the output should contain:
|
91
|
-
"""
|
92
|
-
10 passed
|
93
|
-
"""
|
94
|
-
And it should pass
|