features/generate/generation.feature in pacto-0.3.1 vs features/generate/generation.feature in pacto-0.4.0.rc1
- old
+ new
@@ -10,60 +10,60 @@
Background:
Given a file named "requests/my_contract.json" with:
"""
{
"request": {
- "method": "GET",
+ "http_method": "GET",
"path": "/hello",
"headers": {
"Accept": "application/json"
}
},
"response": {
"status": 200,
- "body": {
+ "schema": {
"required": true
}
}
}
"""
Scenario: Generating a contract using the rake task
Given a directory named "contracts"
When I successfully run `bundle exec rake pacto:generate['tmp/aruba/requests','tmp/aruba/contracts','http://localhost:8000']`
- Then the output should contain "Successfully generated all contracts"
+ Then the stdout should contain "Successfully generated all contracts"
Scenario: Generating a contract programmatically
Given a file named "generate.rb" with:
"""ruby
require 'pacto'
+ Pacto.configuration.generator_options[:no_examples] = true
WebMock.allow_net_connect!
- generator = Pacto::Generator.new
- contract = generator.generate('requests/my_contract.json', 'http://localhost:8000')
+ generator = Pacto::Generator.contract_generator
+ contract = generator.generate_from_partial_contract('requests/my_contract.json', 'http://localhost:8000')
puts contract
"""
When I successfully run `bundle exec ruby generate.rb`
- Then the output should contain exactly:
+ Then the stdout should match this contract:
"""json
{
+ "name": "/hello",
"request": {
"headers": {
"Accept": "application/json"
},
- "method": "get",
- "params": {
- },
+ "http_method": "get",
"path": "/hello"
},
"response": {
"headers": {
"Content-Type": "application/json",
"Vary": "Accept"
},
"status": 200,
- "body": {
+ "schema": {
"$schema": "http://json-schema.org/draft-03/schema#",
"description": "Generated from requests/my_contract.json with shasum 210fa3b144ef2db8d1c160c4d9e8d8bf738ed851",
"type": "object",
"required": true,
"properties": {
@@ -74,6 +74,6 @@
}
}
}
}
- """
\ No newline at end of file
+ """