brine-dsl 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-gemset +1 -0
  3. data/Gemfile.lock +24 -75
  4. data/Rakefile +5 -29
  5. data/brine-dsl.gemspec +3 -5
  6. data/feature_setup.rb +17 -0
  7. data/lib/brine/requester.rb +27 -2
  8. data/lib/brine/step_definitions/request_construction.rb +5 -0
  9. data/lib/brine/test_steps.rb +8 -2
  10. data/lib/brine/type_checks.rb +2 -1
  11. data/lib/brine/util.rb +13 -3
  12. metadata +6 -145
  13. data/.gitignore +0 -3
  14. data/.travis.yml +0 -11
  15. data/CHANGELOG.md +0 -170
  16. data/Guardfile +0 -12
  17. data/LICENSE +0 -21
  18. data/README.adoc +0 -29
  19. data/config/cucumber.yml +0 -2
  20. data/docs/build.gradle +0 -19
  21. data/docs/cookbook.html +0 -643
  22. data/docs/gradle/wrapper/gradle-wrapper.jar +0 -0
  23. data/docs/gradle/wrapper/gradle-wrapper.properties +0 -6
  24. data/docs/gradlew +0 -172
  25. data/docs/gradlew.bat +0 -84
  26. data/docs/guide.html +0 -1220
  27. data/docs/index.html +0 -486
  28. data/docs/specs.html +0 -2066
  29. data/docs/src/cookbook.adoc +0 -160
  30. data/docs/src/guide.adoc +0 -524
  31. data/docs/src/index.adoc +0 -28
  32. data/docs/src/spec.erb +0 -121
  33. data/docs/src/specs.adoc +0 -37
  34. data/features/argument_transforms/boolean.feature +0 -37
  35. data/features/argument_transforms/datetime.feature +0 -45
  36. data/features/argument_transforms/integer.feature +0 -41
  37. data/features/argument_transforms/list.feature +0 -46
  38. data/features/argument_transforms/object.feature +0 -66
  39. data/features/argument_transforms/quoted.feature +0 -41
  40. data/features/argument_transforms/regex.feature +0 -40
  41. data/features/argument_transforms/template.feature +0 -46
  42. data/features/argument_transforms/whitespace.feature +0 -51
  43. data/features/assertions/is_a_valid.feature +0 -184
  44. data/features/assertions/is_empty.feature +0 -67
  45. data/features/assertions/is_equal_to.feature +0 -60
  46. data/features/assertions/is_including.feature +0 -34
  47. data/features/assertions/is_matching.feature +0 -35
  48. data/features/assertions/is_of_length.feature +0 -43
  49. data/features/assignment/parameter.feature +0 -20
  50. data/features/assignment/random.feature +0 -25
  51. data/features/assignment/response_attribute.feature +0 -33
  52. data/features/assignment/timestamp.feature +0 -33
  53. data/features/deprecations/replaced_with.feature +0 -53
  54. data/features/request_construction/basic.feature +0 -29
  55. data/features/request_construction/body.feature +0 -26
  56. data/features/request_construction/clearing.feature +0 -46
  57. data/features/request_construction/headers.feature +0 -94
  58. data/features/request_construction/params.feature +0 -60
  59. data/features/resource_cleanup/cleanup.feature +0 -86
  60. data/features/selectors/all.feature +0 -55
  61. data/features/selectors/any.feature +0 -48
  62. data/features/step_definitions/test_steps.rb +0 -5
  63. data/features/support/env.rb +0 -10
  64. data/tutorial/missing.feature +0 -5
  65. data/tutorial/post_matching.feature +0 -12
  66. data/tutorial/post_status.feature +0 -10
  67. data/tutorial/support/env.rb +0 -2
@@ -1,28 +0,0 @@
1
- = Brine
2
- Matt Whipple <http://github.com/mwhipple[@mwhipple]>
3
- :description: A Cucumber-based DSL for testing REST APIs
4
- :keywords: Brine, Cucumber, REST, DSL
5
-
6
- Cucumber DSL for testing REST APIs
7
-
8
- == Overview
9
-
10
- The documentation should provide the background information to
11
- get started using Brine and a framework for figuring out specific details.
12
- The focus of guides will be on concepts and high level information while
13
- more comprehensive and finer grained information will be provided by
14
- specifications and source. Recipes will be provided for problems which
15
- are common, interesting, or anything anyone wants to contribute :).
16
-
17
- == Documents
18
-
19
- link:guide.html[icon:book[] User Guide]::
20
- A guide to writing specifications using the Brine provided DSL.
21
-
22
- link:specs.html[icon:cogs[] Specification]::
23
- The Gherkin specification for all of Brine's features.
24
-
25
- link:cookbook.html[icon:cutlery[] Cookbook]::
26
- Solutions to some problems which Brine does not solve directly.
27
-
28
- _TODO: The current Cookbook name should be qualified to match its scope_
@@ -1,121 +0,0 @@
1
- <%# TODO: Indentation can't be used because of significance to adoc...comment liberally or abuse tags %>
2
- <%# TODO: Add a lot of CSS classes so the output can be matched back to this template %>
3
-
4
- === [feature name]#<%= feature['name'] %>#
5
-
6
- <%if feature.key?('description') %>
7
- <%# FIXME: Styling doesn't work here and description seems to contain background %>
8
- <%= feature['description'] %>
9
- <% end %>
10
-
11
- <%if feature.key?('background') %>
12
- ==== [background name]#<%= feature['background']['name'] %>#
13
-
14
- <%if feature['background'].key?('description') %>
15
- [background description]#<%= feature['background']['description'] %>#
16
- <% end %>
17
-
18
- <%if feature['background'].key?('steps') %>
19
- [.step-list]
20
- <% feature['background']['steps'].each do |step| %>
21
- * *<%= step['keyword'].strip %>* <%= step['name'] %>
22
-
23
- <%if step.key?('doc_string') %>
24
- [source,gherkin]
25
- ----
26
- <%= step['doc_string']['value'] %>
27
- ----
28
- <% end %>
29
-
30
- <%if step.key?('rows') %>
31
- +<% if step['rows'].first && step['rows'].first.key?('cols') %>
32
- [<%= step['rows'].first['cols'] %>]
33
- <% end %>
34
-
35
- |====
36
- <% step['rows'].each_with_index do |row, index| %>
37
- <% row['cells'].each_with_index do |cell, i| %>
38
- <% if row.key?('cell-styles') && row['cell-styles'].length > i %>
39
- <%= row['cell-styles'][i] %>
40
- <% end %>
41
- | <%= cell %>
42
- <% end %>
43
- <% end %>|====
44
- <% end %>
45
- <% end %>
46
- <% end %>
47
-
48
- <%if feature['background'].key?('examples')
49
- example = feature['background']['examples'] %>
50
-
51
- ==== EX: <%= example['keyword'].strip %> <%= example['name'] %>
52
-
53
- <% if example['rows'].first && example['rows'].first.key?('cols') %>
54
- [<%= example['rows'].first['cols'] %>]
55
- <% end %>
56
-
57
- |====
58
- <% example['rows'].each_with_index do |row, index| %>
59
- <% row['cells'].each_with_index do |cell, i| %>
60
- <% if row.key?('cell-styles') && row['cell-styles'].length > i %>
61
- <%= row['cell-styles'][i] %>
62
- <% end %>
63
- | <%= cell %>
64
- <% end %>
65
- <% if index == 0 %>
66
- <% end %>
67
- <% end %>
68
- |====
69
- <% end %>
70
- <% end %>
71
-
72
- <%if feature.key?('scenarios') %>
73
- <% feature['scenarios'].each do |scenario| %>
74
- ==== [scenario name]#<%= scenario['name'] %>#
75
- <%if scenario.key?('description') %>
76
- <%= scenario['description'] %>
77
- <% end %>
78
- <%if scenario.key?('steps') %>[.step-list]<% scenario['steps'].each do |step| %>
79
- * *<%= step['keyword'].strip %>* <%= step['name'] %>
80
- <%if step.key?('doc_string') %>
81
- [source,gherkin]
82
- ----
83
- <%= step['doc_string']['value'] %>
84
- ----
85
- <% end %>
86
- <%if step.key?('rows') %>
87
- +<% if step['rows'].first && step['rows'].first.key?('cols') %>
88
- [<%= step['rows'].first['cols'] %>]
89
- <% end %>
90
- |====
91
- <% step['rows'].each_with_index do |row, index| %>
92
- <% row['cells'].each_with_index do |cell, i| %>
93
- <% if row.key?('cell-styles') && row['cell-styles'].length > i %>
94
- <%= row['cell-styles'][i] %>
95
- <% end %>
96
- | <%= cell %>
97
- <% end %>
98
- <% end %>|====
99
- <% end %>
100
- <% end %>
101
- <% end %>
102
-
103
- <%if scenario.key?('examples')
104
- example = scenario['examples'] %>
105
- ===== [example name]#<%= example['keyword'].strip %> <%= example['name'] %>#
106
-
107
- <% if example['rows'].first && example['rows'].first.key?('cols') %>
108
- [<%= example['rows'].first['cols'] %>]
109
- <% end %>
110
- |====
111
- <% example['rows'].each_with_index do |row, index| %>
112
- <% row['cells'].each_with_index do |cell, i| %>
113
- <% if row.key?('cell-styles') && row['cell-styles'].length > i %><%= row['cell-styles'][i] %><% end %>
114
- | <%= cell %>
115
- <% end %> <%# cell %>
116
- <% if index == 0 %>
117
- <% end %>
118
- <% end %>|====
119
- <% end %>
120
- <% end %>
121
- <% end %>
@@ -1,37 +0,0 @@
1
- = icon:cogs[] Brine Specifications
2
- Matt Whipple <http://github.com/mwhipple[@mwhipple]>
3
- :description: Specifications for Brine
4
- :keywords: Brine, Cucumber, RESt, DSL
5
-
6
- == Request Construction
7
-
8
- gherkin::../../features/request_construction/basic.feature[spec.erb]
9
- gherkin::../../features/request_construction/body.feature[spec.erb]
10
- gherkin::../../features/request_construction/params.feature[spec.erb]
11
- gherkin::../../features/request_construction/headers.feature[spec.erb]
12
- gherkin::../../features/request_construction/clearing.feature[spec.erb]
13
-
14
- == Resource Cleanup
15
-
16
- gherkin::../../features/resource_cleanup/cleanup.feature[spec.erb]
17
-
18
- == Assignment
19
-
20
- gherkin::../../features/assignment/parameter.feature[spec.erb]
21
- gherkin::../../features/assignment/random.feature[spec.erb]
22
- gherkin::../../features/assignment/timestamp.feature[spec.erb]
23
- gherkin::../../features/assignment/response_attribute.feature[spec.erb]
24
-
25
- == Selection
26
-
27
- gherkin::../../features/selectors/any.feature[spec.erb]
28
- gherkin::../../features/selectors/all.feature[spec.erb]
29
-
30
- == Assertion
31
-
32
- gherkin::../../features/assertions/is_equal_to.feature[spec.erb]
33
- gherkin::../../features/assertions/is_matching.feature[spec.erb]
34
- gherkin::../../features/assertions/is_including.feature[spec.erb]
35
- gherkin::../../features/assertions/is_empty.feature[spec.erb]
36
- gherkin::../../features/assertions/is_of_length.feature[spec.erb]
37
- gherkin::../../features/assertions/is_a_valid.feature[spec.erb]
@@ -1,37 +0,0 @@
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 |
@@ -1,45 +0,0 @@
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
@@ -1,41 +0,0 @@
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 |
@@ -1,46 +0,0 @@
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"] |
@@ -1,66 +0,0 @@
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
-
@@ -1,41 +0,0 @@
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\"}" |