Skip to content

Demo repo for Consumer Driven Contract Tests using Pact

License

Notifications You must be signed in to change notification settings

AndrewJanuary/pact-ruby-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pact-ruby-demo

Demo repo for Consumer Driven Contract Tests using Pact

A proof of concept of Consumer Driven Contract Testing for a message based (non-HTTP) producer and consumer relationship using the pact-message-ruby gem.

Pact already supports non-HTTP interactions and contracts in most languages. An official pact-message-ruby gem has existed for several years.

Scenario

This POC focuses on a hypothetical situation where a potential breaking change has been introduced to a message schema.

The consumer is expecting a message containing a last_name field, however this field has been renamed. The producer is now sending messages with a surname field.

Usage

Running consumer side tests and generating a contract

  1. Execute the consumer side test for the TestMessageConsumer.

bundle exec rspec

  1. The consumer side test should pass.
  2. A contract file will be created representing the consumers expectations of the message format.

Running provider side verification of the contract

  1. Execute the Pact verification Rake task.

bundle exec rake pact:verify

  1. The RSpec tests generated by the Pact provider side verification task should fail.

Releases

No releases published

Packages

No packages published

Languages