|
1 | | -# Pact Ruby End to End Example |
| 1 | +# Pact Ruby End to End Examples |
2 | 2 |
|
3 | 3 | [](https://github.com/pact-foundation/pact-ruby-e2e-example/actions/workflows/test.yml) |
4 | 4 |
|
5 | 5 | Code base to use for demonstrating features or recreating issues in the ruby implementation of pact. Please fork it and modify to demonstrate or recreate your own code. |
6 | 6 |
|
7 | | -This code base is _not_ intended as an example of a best practice pact implementation. Its purpose is to create a running example with the simplest code possible. If you want to see an example of how you would use pact in a Ruby consumer or provider project, see the [example] dir in the pact repository. |
| 7 | +## Projects |
8 | 8 |
|
9 | | -## Usage |
10 | | - |
11 | | -### Fork and clone the codebase |
12 | | - |
13 | | - # Fork the repository using the 'Fork' button on the repository home page, then: |
14 | | - git clone git@github.com:YOUR_USERNAME/pact-ruby-e2e-example.git |
15 | | - cd pact-ruby-e2e-example |
16 | | - |
17 | | -### Set the gem versions you are using |
18 | | - |
19 | | -* Open up the `Gemfile` and set the exact gem versions you are using. eg `gem "pact", "1.12.1"` |
20 | | - |
21 | | -* Run `bundle update` |
22 | | - |
23 | | -### Set up consumer and provider |
24 | | - |
25 | | -* Modify the code in `consumer/spec/bar_spec.rb` to recreate your consumer expectations and actual requests. |
26 | | -* Modify the code in `provider/bar_app.rb` to recreate the response that your provider will return. |
27 | | -* Run `bundle exec rake` to run the consumer specs, generate the pact file, and verify the pact file. |
28 | | -* You will find the pact file in `consumer/spec/pacts/foo-bar.json` |
29 | | -* To run just the consumer specs and generate the pact: `bundle exec rake spec` |
30 | | -* To run just the provider verification: `bundle exec rake pact:verify:foobar` |
31 | | - |
32 | | -### To recreate issues with a local pact broker |
33 | | - |
34 | | -* Set the exact gem versions in `pact_broker/Gemfile` and run `bundle update`. |
35 | | - |
36 | | -* In another terminal, cd into the `pact_broker` directory and run `bundle exec rackup`. |
37 | | - |
38 | | -* Follow the above instructions for setting up the consumer and provider code. |
39 | | - |
40 | | -* In the root directory of this project, run `bundle exec rake pact:verify:foobar_using_local_broker` |
41 | | - |
42 | | -### To recreate issues with a remote pact broker |
43 | | - |
44 | | -* In the `Rakefile` set the `REMOTE_PACT_BROKER_BASE_URL` to the value of your pact broker. |
45 | | - |
46 | | -* Follow the above instructions for setting up the consumer and provider code. |
47 | | - |
48 | | -* Set the `PACT_BROKER_USERNAME` and `PACT_BROKER_PASSWORD` environment variables if you are using a broker with basic auth. |
49 | | - |
50 | | - export PACT_BROKER_USERNAME=your_username |
51 | | - export PACT_BROKER_PASSWORD=your_password |
52 | | - |
53 | | -* In the root directory of this project, run `bundle exec rake pact:verify:foobar_using_remote_broker` |
54 | | - |
55 | | -## Reporting an issue |
56 | | - |
57 | | -* Commit your code on a branch (so you can reuse it for other issues cleanly) and push it to your fork |
58 | | - |
59 | | - git checkout -b "foo-issue" |
60 | | - git add . |
61 | | - git commit -m "Modifying code to recreate my issue" |
62 | | - git push --set-upstream origin foo-issue |
63 | | - |
64 | | -* Open an issue in the appropriate codebase (see [pact-foundation][pact-foundation] for most of the repositories) and include a link to your branch. |
65 | | - |
66 | | -[pact-foundation]: https://github.com/pact-foundation |
67 | | -[example]: https://github.com/pact-foundation/pact-ruby/tree/master/example |
| 9 | +- [e2e http + broker - pact-ruby v1](./e2e-pact-ruby-v1/) |
| 10 | +- [e2e http + broker - pact-ruby v2](./e2e/) |
| 11 | +- [http - pact-ruby v2](./http/) |
| 12 | +- [grpc - pact-ruby v2](./grpc/) |
| 13 | +- [kafka - pact-ruby v2](./kafka/) |
| 14 | +- [message - pact-ruby v2](./message/) |
| 15 | +- [mixed (http, grpc & kafka) - pact-ruby v2](./mixed/) |
| 16 | +- [sample pact broker](./pact_broker/) |
0 commit comments