Created
March 23, 2017 01:59
-
-
Save ian-ellis/a5efb25fe7f6b9076b04c1e3309fe3cb to your computer and use it in GitHub Desktop.
Pact Builder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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