cucumber-http 0.2.1 → 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.
- checksums.yaml +5 -5
- data/README.md +24 -8
- data/lib/cucumber/http/debug_steps.rb +0 -2
- data/lib/cucumber/http/http_steps.rb +34 -10
- data/lib/cucumber/http/version.rb +1 -1
- metadata +10 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3f1be1b47ea1c0772213878f14f19516aa3b6479905e3f82a8e77b12798a6076
|
4
|
+
data.tar.gz: efa78abf389fdf1c32d2e7bd5b48dbfabcd44acb7a90f20dd8c0cfff5fbfaee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54ebb323e49b717a1780eba422d971eddaa42a0140cd77858af510f60da0c43788d7dc65bc85e3e8b8bac2f322074acf3ba7b98c0930c296009527e17320950e
|
7
|
+
data.tar.gz: df4ac0a1b5dae08baa6adcb9cc6155ce7fb1ccac4b6cadebc7f1ee3bed0458d622b95935e7a6fd370a4b5459b19c5e35c14404926dc8583e1063909f4f8b626b
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ Feature: Test the UDB3 labels API
|
|
38
38
|
Background:
|
39
39
|
Given I am using the UDB3 development environment
|
40
40
|
And I am authorized as user "centraal_beheerder"
|
41
|
-
And I send and accept
|
41
|
+
And I send "application/json" and accept "application/ld+json"
|
42
42
|
|
43
43
|
@labelcreate
|
44
44
|
Scenario: Create label
|
@@ -67,11 +67,27 @@ Given /^I set headers?:$/
|
|
67
67
|
```
|
68
68
|
|
69
69
|
```ruby
|
70
|
-
Given /^I send "(.*?)"
|
70
|
+
Given /^I send "(.*?)"$/
|
71
71
|
```
|
72
72
|
|
73
73
|
```ruby
|
74
|
-
Given /^I
|
74
|
+
Given /^I accept "(.*?)"$/
|
75
|
+
```
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
Given /^I send and accept "(.*?)"$/
|
79
|
+
```
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
Given /^I send "(.*?)" and accept "(.*?)"$/
|
83
|
+
```
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
Given /^I send "(.*?)" and accept JSON$/
|
87
|
+
```
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
Given /^I send and accept JSON$/
|
75
91
|
```
|
76
92
|
|
77
93
|
```ruby
|
@@ -91,7 +107,7 @@ Then /^the response status should( not)? be "(#{CAPTURE_INTEGER})"$/
|
|
91
107
|
```
|
92
108
|
|
93
109
|
```ruby
|
94
|
-
Then /^the response body should be valid
|
110
|
+
Then /^the response body should be valid JSON$/
|
95
111
|
```
|
96
112
|
|
97
113
|
#### Debugging
|
@@ -122,12 +138,12 @@ Examples for testing the [REST API](https://apidoc.uitdatabank.be) of
|
|
122
138
|
|
123
139
|
Creating an organizer with a random name:
|
124
140
|
```ruby
|
125
|
-
When /^I
|
141
|
+
When /^I create an organizer with a random name of (#{CAPTURE_INTEGER}) characters?$/ do |characters|
|
126
142
|
name = Faker::Lorem.characters(characters)
|
127
143
|
steps %Q{
|
128
144
|
Given I am using the UDB3 development environment
|
129
145
|
And I am authorized as user "centraal_beheerder"
|
130
|
-
And I send and accept
|
146
|
+
And I send and accept "application/json"
|
131
147
|
When I set the JSON request payload to:
|
132
148
|
"""
|
133
149
|
{"mainLanguage":"nl","website":"https://www.#{name}.be","name":"#{name}","contact":[]}
|
@@ -139,12 +155,12 @@ end
|
|
139
155
|
|
140
156
|
Creating a role with a random name:
|
141
157
|
```ruby
|
142
|
-
When /^I
|
158
|
+
When /^I create a role with a random name of (#{CAPTURE_INTEGER}) characters?$/ do |characters|
|
143
159
|
name = Faker::Lorem.characters(characters)
|
144
160
|
steps %Q{
|
145
161
|
Given I am using the UDB3 development environment
|
146
162
|
And I am authorized as user "centraal_beheerder"
|
147
|
-
And I send and accept
|
163
|
+
And I send and accept "application/json"
|
148
164
|
When I set the JSON request payload to:
|
149
165
|
"""
|
150
166
|
{ "name": "#{name}" }
|
@@ -12,8 +12,6 @@ Then /^show me the( unparsed)? response$/ do |unparsed|
|
|
12
12
|
if unparsed.nil?
|
13
13
|
if response[:headers]['content-type'][0] =~ /json/
|
14
14
|
body = JSON.pretty_generate(JSON.parse(response[:body]))
|
15
|
-
elsif response[:headers]['content-type'][0] =~ /xml/
|
16
|
-
body = Nokogiri::XML(response[:body])
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
@@ -1,11 +1,40 @@
|
|
1
|
-
require 'nokogiri'
|
2
1
|
require 'json_spec'
|
3
2
|
|
4
3
|
Given /^I set headers?:$/ do |hdrs|
|
5
4
|
hdrs.rows_hash.each { |name, value| add_header(name, value) }
|
6
5
|
end
|
7
6
|
|
8
|
-
Given /^I send "(.*?)"
|
7
|
+
Given /^I send "(.*?)"$/ do |content_type|
|
8
|
+
steps %Q{
|
9
|
+
Given I set headers:
|
10
|
+
| Content-Type | #{content_type} |
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
Given /^I accept "(.*?)"$/ do |accept_type|
|
15
|
+
steps %Q{
|
16
|
+
Given I set headers:
|
17
|
+
| Accept | #{accept_type} |
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
Given /^I send and accept "(.*?)"$/ do |type|
|
22
|
+
steps %Q{
|
23
|
+
Given I set headers:
|
24
|
+
| Content-Type | #{type} |
|
25
|
+
| Accept | #{type} |
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
Given /^I send "(.*?)" and accept "(.*?)"$/ do |content_type, accept_type|
|
30
|
+
steps %Q{
|
31
|
+
Given I set headers:
|
32
|
+
| Content-Type | #{content_type} |
|
33
|
+
| Accept | #{accept_type} |
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
Given /^I send "(.*?)" and accept JSON$/ do |content_type, accept_type|
|
9
38
|
steps %Q{
|
10
39
|
Given I set headers:
|
11
40
|
| Content-Type | #{content_type} |
|
@@ -13,7 +42,7 @@ Given /^I send "(.*?)" and accept (XML|JSON)$/ do |content_type, accept_type|
|
|
13
42
|
}
|
14
43
|
end
|
15
44
|
|
16
|
-
Given /^I send and accept
|
45
|
+
Given /^I send and accept JSON$/ do |type|
|
17
46
|
steps %Q{
|
18
47
|
Given I set headers:
|
19
48
|
| Content-Type | application/#{type.downcase} |
|
@@ -71,11 +100,6 @@ Then /^the response status should( not)? be "(#{CAPTURE_INTEGER})"$/ do |negativ
|
|
71
100
|
end
|
72
101
|
end
|
73
102
|
|
74
|
-
Then /^the response body should be valid
|
75
|
-
|
76
|
-
when 'XML'
|
77
|
-
expect { Nokogiri::XML(response[:body]) { |config| config.strict } }.not_to raise_error
|
78
|
-
when 'JSON'
|
79
|
-
expect { JSON.parse(response[:body]) }.not_to raise_error
|
80
|
-
end
|
103
|
+
Then /^the response body should be valid JSON$/ do |type|
|
104
|
+
expect { JSON.parse(response[:body]) }.not_to raise_error
|
81
105
|
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kristof Willaert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -44,28 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.8'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: nokogiri
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.6'
|
47
|
+
version: '2.0'
|
62
48
|
type: :runtime
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
54
|
+
version: '2.0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: faker
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,9 +94,9 @@ dependencies:
|
|
108
94
|
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '1.9'
|
111
|
-
description: Cucumber steps to easily test external
|
97
|
+
description: Cucumber steps to easily test external JSON APIs
|
112
98
|
email:
|
113
|
-
- kristof.willaert@
|
99
|
+
- kristof.willaert@publiq.be
|
114
100
|
executables: []
|
115
101
|
extensions: []
|
116
102
|
extra_rdoc_files: []
|
@@ -150,9 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
136
|
- !ruby/object:Gem::Version
|
151
137
|
version: '0'
|
152
138
|
requirements: []
|
153
|
-
|
154
|
-
rubygems_version: 2.5.2.3
|
139
|
+
rubygems_version: 3.1.2
|
155
140
|
signing_key:
|
156
141
|
specification_version: 4
|
157
|
-
summary: Cucumber steps to easily test
|
142
|
+
summary: Cucumber steps to easily test JSON APIs
|
158
143
|
test_files: []
|