Skip to content

Instantly share code, notes, and snippets.

@ian-ellis
Created March 23, 2017 01:59
Show Gist options
  • Save ian-ellis/a5efb25fe7f6b9076b04c1e3309fe3cb to your computer and use it in GitHub Desktop.
Save ian-ellis/a5efb25fe7f6b9076b04c1e3309fe3cb to your computer and use it in GitHub Desktop.
Pact Builder
pactBuilder {
serviceConsumer 'Android_App'
hasPactWith 'Eve_v1'
port PORT
uponReceiving 'A request for products'
withAttributes(
method: 'GET',
path: "/catalog/products",
headers: ['Accept': 'application/json'],
query: "gender="+request_gender
)
willRespondWith(
status: 200,
headers: ['Content-Type': 'application/hal+json']
)
withBody() {
_embedded {
product minLike(1, 2) {
sku string('FR760AA31JSE')
name string('Alaska Coat')
ribbon string('new')
short_description string('A product description')
price numeric(169.95) //check above 0
special_price numeric(0)
link string('Alaska-Coat-217468.html')
_embedded {
brand {
id integer(1234)
url_key string('awesome')
name string('Awesome Brand')
}
gender {
id integer(15)
name regexp('male|female|unisex', 'male')
}
shops minLike(1, 1) {
name string('sports')
is_default(false)
}
images minLike(1, 1) {
url string('http://static.theiconic.com.au/p/fresh-soul-1697-864712-1.jpg')
}
}
}
}
_links {
self {
href string('http://eve.theiconic.com.au/v1/catalog/products?page=1')
}
}
page_count identifier(1)
page_size identifier(24)
total_items identifier(2)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment