cucumber-http 0.3.0 → 0.5.1
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/README.md +22 -6
 - data/lib/cucumber/http/debug_steps.rb +0 -2
 - data/lib/cucumber/http/http_steps.rb +38 -14
 - data/lib/cucumber/http/version.rb +1 -1
 - metadata +6 -20
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 70917cc0394f65db06b914e26836bf920b17fc5120127679a53036d379ebe4c1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e0f37cc9f42f5ccaae713d2552fbd94de84f8d36c1384f981666bb0556515298
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: d046821b5b54f7a6ed66c5af93508960c3f5191255f9bae74ab683443434c91a87e817d7c5637c3925b1695682dd835a6e2ce53bc4dba53f020df6e9ee98c3a0
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: cf9804b017bb0c10f7ffa132af654fe0d1749b95d5fa06cd18a81e16c40529ca9adf035e385879bbfc35e74e1dd69f047843eeb58c6d1609c5d615934b35856e
         
     | 
    
        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
         
     | 
| 
         @@ -127,7 +143,7 @@ When /^I create an organizer with a random name of (#{CAPTURE_INTEGER}) characte 
     | 
|
| 
       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":[]}
         
     | 
| 
         @@ -144,7 +160,7 @@ When /^I create a role with a random name of (#{CAPTURE_INTEGER}) 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,23 +1,52 @@ 
     | 
|
| 
       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|
         
     | 
| 
       9 
8 
     | 
    
         
             
              steps %Q{
         
     | 
| 
       10 
9 
     | 
    
         
             
                Given I set headers:
         
     | 
| 
       11 
     | 
    
         
            -
                  | Content-Type | #{content_type} 
     | 
| 
       12 
     | 
    
         
            -
                  | Accept       | application/#{accept_type.downcase} |
         
     | 
| 
      
 10 
     | 
    
         
            +
                  | Content-Type | #{content_type} |
         
     | 
| 
       13 
11 
     | 
    
         
             
              }
         
     | 
| 
       14 
12 
     | 
    
         
             
            end
         
     | 
| 
       15 
13 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
            Given /^I  
     | 
| 
      
 14 
     | 
    
         
            +
            Given /^I accept "(.*?)"$/ do |accept_type|
         
     | 
| 
       17 
15 
     | 
    
         
             
              steps %Q{
         
     | 
| 
       18 
16 
     | 
    
         
             
                Given I set headers:
         
     | 
| 
       19 
     | 
    
         
            -
                  |  
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 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|
         
     | 
| 
      
 38 
     | 
    
         
            +
              steps %Q{
         
     | 
| 
      
 39 
     | 
    
         
            +
                Given I set headers:
         
     | 
| 
      
 40 
     | 
    
         
            +
                  | Content-Type | #{content_type}  |
         
     | 
| 
      
 41 
     | 
    
         
            +
                  | Accept       | application/json |
         
     | 
| 
      
 42 
     | 
    
         
            +
              }
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            Given /^I send and accept JSON$/ do
         
     | 
| 
      
 46 
     | 
    
         
            +
              steps %Q{
         
     | 
| 
      
 47 
     | 
    
         
            +
                Given I set headers:
         
     | 
| 
      
 48 
     | 
    
         
            +
                  | Content-Type | application/json |
         
     | 
| 
      
 49 
     | 
    
         
            +
                  | Accept       | application/json |
         
     | 
| 
       21 
50 
     | 
    
         
             
              }
         
     | 
| 
       22 
51 
     | 
    
         
             
            end
         
     | 
| 
       23 
52 
     | 
    
         | 
| 
         @@ -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
         
     | 
| 
      
 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.1
         
     | 
| 
       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-09 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
         
     | 
| 
         @@ -52,20 +52,6 @@ dependencies: 
     | 
|
| 
       52 
52 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       53 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
54 
     | 
    
         
             
                    version: '2.0'
         
     | 
| 
       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'
         
     | 
| 
       62 
     | 
    
         
            -
              type: :runtime
         
     | 
| 
       63 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       64 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
     | 
    
         
            -
                requirements:
         
     | 
| 
       66 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       67 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version: '1.6'
         
     | 
| 
       69 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
56 
     | 
    
         
             
              name: faker
         
     | 
| 
       71 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -108,7 +94,7 @@ 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 
99 
     | 
    
         
             
            - kristof.willaert@publiq.be
         
     | 
| 
       114 
100 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -153,5 +139,5 @@ requirements: [] 
     | 
|
| 
       153 
139 
     | 
    
         
             
            rubygems_version: 3.1.2
         
     | 
| 
       154 
140 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       155 
141 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       156 
     | 
    
         
            -
            summary: Cucumber steps to easily test  
     | 
| 
      
 142 
     | 
    
         
            +
            summary: Cucumber steps to easily test JSON APIs
         
     | 
| 
       157 
143 
     | 
    
         
             
            test_files: []
         
     |