pact_broker 2.89.1 → 2.90.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (681) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/db/ddl_statements/all_verifications.rb +21 -0
  4. data/db/migrations/20210701_recreate_all_verifications.rb +18 -0
  5. data/db/migrations/20211101_recreate_all_verifications.rb +10 -0
  6. data/db/migrations/20211102_create_table_temp_integrations.rb +26 -0
  7. data/db/migrations/20211103_migrate_integrations.rb +21 -0
  8. data/db/migrations/20211104_switch_integrations_and_temp_integrations.rb +25 -0
  9. data/docs/CONFIGURATION.md +30 -0
  10. data/lib/pact_broker/app.rb +1 -1
  11. data/lib/pact_broker/certificates/service.rb +32 -2
  12. data/lib/pact_broker/config/runtime_configuration.rb +9 -0
  13. data/lib/pact_broker/config/runtime_configuration_logging_methods.rb +6 -2
  14. data/lib/pact_broker/db/data_migrations/migrate_integrations.rb +40 -0
  15. data/lib/pact_broker/db/migrate_data.rb +1 -0
  16. data/lib/pact_broker/doc/views/webhooks.markdown +23 -0
  17. data/lib/pact_broker/domain/pacticipant.rb +2 -0
  18. data/lib/pact_broker/integrations/integration.rb +34 -10
  19. data/lib/pact_broker/integrations/repository.rb +22 -0
  20. data/lib/pact_broker/integrations/service.rb +2 -2
  21. data/lib/pact_broker/locale/en.yml +1 -2
  22. data/lib/pact_broker/pacticipants/repository.rb +5 -0
  23. data/lib/pact_broker/pacticipants/service.rb +1 -1
  24. data/lib/pact_broker/pacts/merger.rb +8 -4
  25. data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +1 -1
  26. data/lib/pact_broker/pacts/repository.rb +1 -0
  27. data/lib/pact_broker/repositories.rb +5 -0
  28. data/lib/pact_broker/tasks/clean_task.rb +11 -0
  29. data/lib/pact_broker/test/test_data_builder.rb +6 -0
  30. data/lib/pact_broker/version.rb +1 -1
  31. data/lib/pact_broker/webhooks/pact_and_verification_parameters.rb +1 -2
  32. data/pact_broker.gemspec +8 -1
  33. data/public/css/bootstrap-grid.css +170 -17
  34. data/public/css/bootstrap-grid.css.map +1 -1
  35. data/public/css/bootstrap-grid.min.css +5 -5
  36. data/public/css/bootstrap-grid.min.css.map +1 -1
  37. data/public/css/bootstrap-reboot.css +16 -22
  38. data/public/css/bootstrap-reboot.css.map +1 -1
  39. data/public/css/bootstrap-reboot.min.css +5 -5
  40. data/public/css/bootstrap-reboot.min.css.map +1 -1
  41. data/public/css/bootstrap.css +585 -308
  42. data/public/css/bootstrap.css.map +1 -1
  43. data/public/css/bootstrap.min.css +5 -5
  44. data/public/css/bootstrap.min.css.map +1 -1
  45. data/public/images/question.svg +1 -0
  46. data/public/js/bootstrap.bundle.js +1294 -1335
  47. data/public/js/bootstrap.bundle.js.map +1 -1
  48. data/public/js/bootstrap.bundle.min.js +4 -4
  49. data/public/js/bootstrap.bundle.min.js.map +1 -1
  50. data/public/js/bootstrap.js +1232 -1310
  51. data/public/js/bootstrap.js.map +1 -1
  52. data/public/js/bootstrap.min.js +4 -4
  53. data/public/js/bootstrap.min.js.map +1 -1
  54. metadata +13 -1067
  55. data/.codeclimate.yml +0 -49
  56. data/.csslintrc +0 -2
  57. data/.dockerignore +0 -2
  58. data/.eslintignore +0 -1
  59. data/.eslintrc.yml +0 -277
  60. data/.github/FUNDING.yml +0 -4
  61. data/.github/ISSUE_TEMPLATE.md +0 -32
  62. data/.github/PULL_REQUEST_TEMPLATE.md +0 -9
  63. data/.github/workflows/release_gem.yml +0 -52
  64. data/.github/workflows/test-ruby-3.yml +0 -19
  65. data/.github/workflows/test.yml +0 -95
  66. data/.github/workflows/trigger_pact_docs_update.yml +0 -23
  67. data/.gitignore +0 -45
  68. data/.optic/.gitignore +0 -2
  69. data/.optic/api/specification.json +0 -1
  70. data/.optic/ignore +0 -14
  71. data/.rspec +0 -3
  72. data/.rubocop.yml +0 -314
  73. data/.ruby-version +0 -1
  74. data/CODE_OF_CONDUCT.md +0 -76
  75. data/CONTRIBUTING.md +0 -29
  76. data/DEVELOPER_DOCUMENTATION.md +0 -161
  77. data/DEVELOPER_SETUP.md +0 -165
  78. data/Dockerfile +0 -52
  79. data/ISSUES.md +0 -31
  80. data/LICENSE.txt +0 -22
  81. data/MATRIX.md +0 -4
  82. data/RELEASING.md +0 -5
  83. data/Rakefile +0 -23
  84. data/UPGRADING.md +0 -18
  85. data/config/boot.rb +0 -21
  86. data/config/database.travis.yml +0 -13
  87. data/config/database.yml +0 -79
  88. data/config.ru +0 -11
  89. data/db/test/backwards_compatibility/.rspec +0 -3
  90. data/db/test/backwards_compatibility/Appraisals +0 -57
  91. data/db/test/backwards_compatibility/Gemfile +0 -12
  92. data/db/test/backwards_compatibility/Rakefile +0 -72
  93. data/db/test/backwards_compatibility/config.ru +0 -21
  94. data/db/test/backwards_compatibility/gemfiles/1.18.0.gemfile +0 -15
  95. data/db/test/backwards_compatibility/gemfiles/1.18.0.gemfile.lock +0 -212
  96. data/db/test/backwards_compatibility/gemfiles/2.0.0.gemfile +0 -15
  97. data/db/test/backwards_compatibility/gemfiles/2.0.0.gemfile.lock +0 -210
  98. data/db/test/backwards_compatibility/gemfiles/2.1.0.gemfile +0 -15
  99. data/db/test/backwards_compatibility/gemfiles/2.1.0.gemfile.lock +0 -211
  100. data/db/test/backwards_compatibility/gemfiles/2.2.0.gemfile +0 -15
  101. data/db/test/backwards_compatibility/gemfiles/2.2.0.gemfile.lock +0 -199
  102. data/db/test/backwards_compatibility/gemfiles/2.3.0.gemfile +0 -14
  103. data/db/test/backwards_compatibility/gemfiles/2.3.0.gemfile.lock +0 -198
  104. data/db/test/backwards_compatibility/gemfiles/2.4.2.gemfile +0 -14
  105. data/db/test/backwards_compatibility/gemfiles/2.4.2.gemfile.lock +0 -198
  106. data/db/test/backwards_compatibility/gemfiles/2.5.1.gemfile +0 -14
  107. data/db/test/backwards_compatibility/gemfiles/2.5.1.gemfile.lock +0 -198
  108. data/db/test/backwards_compatibility/gemfiles/2.6.0.gemfile +0 -14
  109. data/db/test/backwards_compatibility/gemfiles/2.6.0.gemfile.lock +0 -198
  110. data/db/test/backwards_compatibility/gemfiles/head.gemfile +0 -14
  111. data/db/test/backwards_compatibility/gemfiles/head.gemfile.lock +0 -182
  112. data/db/test/backwards_compatibility/spec/fixtures/foo-bar.json +0 -22
  113. data/db/test/backwards_compatibility/spec/publish_pact_spec.rb +0 -72
  114. data/db/test/backwards_compatibility/spec/spec_helper.rb +0 -20
  115. data/db/test/backwards_compatibility/spec/support/fixture_helpers.rb +0 -12
  116. data/db/test/backwards_compatibility/spec/support/request_helpers.rb +0 -19
  117. data/db/test/change_migration_strategy/Rakefile +0 -21
  118. data/db/test/change_migration_strategy/before/Gemfile +0 -7
  119. data/docker-compose-ci-mysql.yml +0 -38
  120. data/docker-compose-dev-postgres.yml +0 -43
  121. data/docker-compose-issue-repro-with-pact-broker-docker-image.yml +0 -44
  122. data/docker-compose-test.yml +0 -102
  123. data/docs/configuration.yml +0 -385
  124. data/docs/images/Pactflow logo - black small.png +0 -0
  125. data/example/Gemfile +0 -6
  126. data/example/README.md +0 -64
  127. data/example/config/pact_broker.yml +0 -9
  128. data/example/config/puma.rb +0 -3
  129. data/example/config.ru +0 -10
  130. data/issue-reproduction/Dockerfile-pact-broker +0 -42
  131. data/optic.yml +0 -5
  132. data/pact_broker_client-pact_broker.json +0 -133
  133. data/public/js/npm.js +0 -13
  134. data/regression/.gitignore +0 -1
  135. data/regression/can_i_deploy_spec.rb +0 -43
  136. data/regression/index_spec.rb +0 -26
  137. data/regression/regression_helper.rb +0 -63
  138. data/regression/script/approval-all.sh +0 -6
  139. data/regression/script/clear.sh +0 -3
  140. data/regression/script/run.sh +0 -3
  141. data/scaffolding/README.md +0 -23
  142. data/scaffolding/run.rb +0 -242
  143. data/scaffolding/templates/decorator.rb.erb +0 -15
  144. data/scaffolding/templates/decorator_spec.erb.rb +0 -0
  145. data/scaffolding/templates/migration.erb +0 -12
  146. data/scaffolding/templates/model.erb +0 -14
  147. data/scaffolding/templates/repository.rb.erb +0 -18
  148. data/scaffolding/templates/repository_spec.rb.erb +0 -9
  149. data/scaffolding/templates/resource.erb +0 -46
  150. data/scaffolding/templates/resource_spec.rb.erb +0 -78
  151. data/scaffolding/templates/service.rb.erb +0 -22
  152. data/scaffolding/templates/service_spec.rb.erb +0 -9
  153. data/script/data/auto-create-things-for-tags.rb +0 -22
  154. data/script/data/branches.rb +0 -35
  155. data/script/data/contract-published-requiring-verification.rb +0 -26
  156. data/script/data/environments.rb +0 -45
  157. data/script/data/expand-currently-deployed.rb +0 -47
  158. data/script/data/issue-494.rb +0 -25
  159. data/script/data/pending.rb +0 -26
  160. data/script/data/tags.rb +0 -35
  161. data/script/data/verify-pact-for-multiple-selectors.rb +0 -30
  162. data/script/data/webhook.rb +0 -22
  163. data/script/db-spec.sh +0 -16
  164. data/script/demonstrate-version-branches.rb +0 -33
  165. data/script/dev/rubocop-modified-files.sh +0 -3
  166. data/script/dev/webhook-server-with-random-errors.sh +0 -25
  167. data/script/docker/db-execute-sql-file.sh +0 -2
  168. data/script/docker/db-psql.sh +0 -3
  169. data/script/docker/db-reload.sh +0 -11
  170. data/script/docker/db-restore.sh +0 -5
  171. data/script/docker/db-rm.sh +0 -3
  172. data/script/docker/db-start.sh +0 -7
  173. data/script/docker/mysql-db-start.sh +0 -10
  174. data/script/docker-container/test.sh +0 -3
  175. data/script/docs/generate-api-docs.rb +0 -117
  176. data/script/docs/generate-configuration-docs.rb +0 -107
  177. data/script/docs/regenerate-api-docs.sh +0 -11
  178. data/script/exercise-api-for-optic.sh +0 -3
  179. data/script/foo-bar-verification.json +0 -59
  180. data/script/foo-bar.json +0 -33
  181. data/script/generate-certificates-for-webooks-certificate-spec.rb +0 -49
  182. data/script/generate-erd +0 -55
  183. data/script/github-issues/add-branch-support/issue-text.txt +0 -7
  184. data/script/github-issues/add-branch-support/issues.txt +0 -0
  185. data/script/github-issues/add-branch-support/raise-issue-in-client-repos.sh +0 -10
  186. data/script/github-issues/add-branch-support-for-provider-versions/issue-text.txt +0 -9
  187. data/script/github-issues/add-branch-support-for-provider-versions/issues.txt +0 -6
  188. data/script/github-issues/add-branch-support-for-provider-versions/raise-issue-in-client-repos.sh +0 -10
  189. data/script/github-issues/branch-consumer-version-selector/issue-text.txt +0 -52
  190. data/script/github-issues/branch-consumer-version-selector/issues.txt +0 -9
  191. data/script/github-issues/branch-consumer-version-selector/raise-issue-in-client-repos.sh +0 -10
  192. data/script/github-issues/consumer-version-selectors-docs/issue-text.txt +0 -11
  193. data/script/github-issues/consumer-version-selectors-docs/issues.txt +0 -6
  194. data/script/github-issues/consumer-version-selectors-docs/raise-issue-in-client-repos.sh +0 -10
  195. data/script/github-issues/deployed-and-released-selectors-docs/issue-text.txt +0 -26
  196. data/script/github-issues/deployed-and-released-selectors-docs/issues.txt +0 -9
  197. data/script/github-issues/deployed-and-released-selectors-docs/raise-issue-in-client-repos.sh +0 -10
  198. data/script/github-issues/include-pending-by-default/issue-text.txt +0 -5
  199. data/script/github-issues/include-pending-by-default/issues.txt +0 -10
  200. data/script/github-issues/include-pending-by-default/raise-issue-in-client-repos.sh +0 -10
  201. data/script/import-pg-database.sh +0 -5
  202. data/script/insert-self-signed-certificate-from-url.rb +0 -35
  203. data/script/prod/clean-up.sql +0 -11
  204. data/script/prod/migrate-latest-pacts.sh +0 -29
  205. data/script/prod/redact-data.sql +0 -16
  206. data/script/pry.rb +0 -31
  207. data/script/publish-2.sh +0 -4
  208. data/script/publish-new.sh +0 -31
  209. data/script/publish-not-a-pact.sh +0 -4
  210. data/script/publish-verification.sh +0 -5
  211. data/script/publish.sh +0 -28
  212. data/script/query.rb +0 -20
  213. data/script/recreate-docker-pg-db.sh +0 -20
  214. data/script/recreate-mysql-db.sh +0 -18
  215. data/script/recreate-pg-db.sh +0 -16
  216. data/script/recreate-test-database.sh +0 -2
  217. data/script/release-via-github-action.sh +0 -7
  218. data/script/release.sh +0 -11
  219. data/script/reproduce-issue-can-i-deploy-ignore.rb +0 -48
  220. data/script/reproduce-issue-starting-up.rb +0 -38
  221. data/script/reproduce-issue.rb +0 -37
  222. data/script/restart.sh +0 -18
  223. data/script/run-with-ssl.rb +0 -44
  224. data/script/seed-example-matrix.rb +0 -105
  225. data/script/seed-for-webhook-test.rb +0 -59
  226. data/script/seed-matrix.rb +0 -90
  227. data/script/seed.rb +0 -101
  228. data/script/test/approval-all.sh +0 -6
  229. data/script/test/run-rake-on-docker-compose-mysql.sh +0 -8
  230. data/script/trigger-release.sh +0 -30
  231. data/script/update-hal-browser +0 -6
  232. data/script/watch.sh +0 -7
  233. data/script/webhook-server.ru +0 -10
  234. data/spec/features/base_equality_only_on_content_that_affects_verification_results_spec.rb +0 -34
  235. data/spec/features/can_i_deploy_spec.rb +0 -31
  236. data/spec/features/create_branch_version_spec.rb +0 -29
  237. data/spec/features/create_environment_spec.rb +0 -47
  238. data/spec/features/create_pacticipant_spec.rb +0 -36
  239. data/spec/features/create_tag_spec.rb +0 -42
  240. data/spec/features/create_version_spec.rb +0 -56
  241. data/spec/features/create_webhook_spec.rb +0 -189
  242. data/spec/features/delete_environment_spec.rb +0 -16
  243. data/spec/features/delete_integration_spec.rb +0 -27
  244. data/spec/features/delete_label_spec.rb +0 -28
  245. data/spec/features/delete_pact_spec.rb +0 -31
  246. data/spec/features/delete_pact_versions_for_branch_spec.rb +0 -34
  247. data/spec/features/delete_pact_versions_spec.rb +0 -29
  248. data/spec/features/delete_tagged_pact_versions_spec.rb +0 -28
  249. data/spec/features/delete_verification_spec.rb +0 -27
  250. data/spec/features/delete_version_spec.rb +0 -22
  251. data/spec/features/delete_webhook_spec.rb +0 -34
  252. data/spec/features/edit_webhook_spec.rb +0 -61
  253. data/spec/features/end_deployment_spec.rb +0 -29
  254. data/spec/features/end_support_spec.rb +0 -67
  255. data/spec/features/execute_unsaved_webhook_spec.rb +0 -53
  256. data/spec/features/execute_webhook_spec.rb +0 -92
  257. data/spec/features/get_branch_version_spec.rb +0 -12
  258. data/spec/features/get_can_i_deploy_badge_spec.rb +0 -13
  259. data/spec/features/get_currently_deployed_versions_for_environment_spec.rb +0 -76
  260. data/spec/features/get_currently_deployed_versions_for_version_spec.rb +0 -27
  261. data/spec/features/get_currently_supported_versions_for_environment_spec.rb +0 -57
  262. data/spec/features/get_dashboard_spec.rb +0 -29
  263. data/spec/features/get_deployed_versions_for_version_and_environment.rb +0 -27
  264. data/spec/features/get_diff_spec.rb +0 -53
  265. data/spec/features/get_environment_spec.rb +0 -19
  266. data/spec/features/get_environments_spec.rb +0 -30
  267. data/spec/features/get_integrations_dot_file_spec.rb +0 -23
  268. data/spec/features/get_integrations_spec.rb +0 -17
  269. data/spec/features/get_label_spec.rb +0 -28
  270. data/spec/features/get_latest_pact_badge_spec.rb +0 -54
  271. data/spec/features/get_latest_tagged_pact_badge_spec.rb +0 -38
  272. data/spec/features/get_latest_tagged_pact_spec.rb +0 -22
  273. data/spec/features/get_latest_untagged_pact_badge_spec.rb +0 -38
  274. data/spec/features/get_latest_untagged_pact_spec.rb +0 -22
  275. data/spec/features/get_latest_verification_for_pact_spec.rb +0 -59
  276. data/spec/features/get_matrix_badge_spec.rb +0 -50
  277. data/spec/features/get_matrix_for_consumer_and_provider_spec.rb +0 -22
  278. data/spec/features/get_matrix_spec.rb +0 -34
  279. data/spec/features/get_pact_spec.rb +0 -65
  280. data/spec/features/get_pact_version.rb +0 -36
  281. data/spec/features/get_pact_versions_spec.rb +0 -34
  282. data/spec/features/get_pacticipants_by_label_spec.rb +0 -27
  283. data/spec/features/get_previous_distinct_version.rb +0 -51
  284. data/spec/features/get_provider_pacts_for_verification_spec.rb +0 -95
  285. data/spec/features/get_provider_pacts_spec.rb +0 -93
  286. data/spec/features/get_released_versions_for_version_and_environment.rb +0 -27
  287. data/spec/features/get_tagged_pact_versions_spec.rb +0 -26
  288. data/spec/features/get_triggered_webhooks_for_pact_spec.rb +0 -20
  289. data/spec/features/get_triggered_webhooks_for_verification_spec.rb +0 -21
  290. data/spec/features/get_verifications_for_consumer_version_spec.rb +0 -33
  291. data/spec/features/get_version_spec.rb +0 -44
  292. data/spec/features/get_versions_spec.rb +0 -39
  293. data/spec/features/label_pacticipant_spec.rb +0 -22
  294. data/spec/features/merge_pact_spec.rb +0 -63
  295. data/spec/features/metadata_spec.rb +0 -66
  296. data/spec/features/metrics_spec.rb +0 -23
  297. data/spec/features/pending_pacts_spec.rb +0 -109
  298. data/spec/features/pending_pacts_with_tags_spec.rb +0 -138
  299. data/spec/features/publish_not_a_pact_spec.rb +0 -37
  300. data/spec/features/publish_pact_all_in_one_approval_spec.rb +0 -72
  301. data/spec/features/publish_pact_all_in_one_spec.rb +0 -61
  302. data/spec/features/publish_pact_spec.rb +0 -124
  303. data/spec/features/publish_verification_results_and_version_spec.rb +0 -70
  304. data/spec/features/publish_verification_spec.rb +0 -72
  305. data/spec/features/record_deployment_spec.rb +0 -106
  306. data/spec/features/record_release_spec.rb +0 -84
  307. data/spec/features/record_undeployment_spec.rb +0 -67
  308. data/spec/features/tag_version_spec.rb +0 -13
  309. data/spec/features/update_environment_spec.rb +0 -44
  310. data/spec/features/update_matrix_spec.rb +0 -146
  311. data/spec/features/update_pacticipant_spec.rb +0 -98
  312. data/spec/features/update_version_spec.rb +0 -100
  313. data/spec/features/update_webhook_spec.rb +0 -47
  314. data/spec/features/wip_pacts_spec.rb +0 -387
  315. data/spec/fixtures/a_consumer-a_provider-2.json +0 -22
  316. data/spec/fixtures/a_consumer-a_provider-3.json +0 -22
  317. data/spec/fixtures/a_consumer-a_provider-conflict.json +0 -22
  318. data/spec/fixtures/a_consumer-a_provider-merged.json +0 -34
  319. data/spec/fixtures/a_consumer-a_provider.json +0 -22
  320. data/spec/fixtures/approvals/clean_incremental_dry_run.approved.json +0 -100
  321. data/spec/fixtures/approvals/docs_webhooks_executing_a_saved_webhook_options.approved.json +0 -20
  322. data/spec/fixtures/approvals/docs_webhooks_executing_a_saved_webhook_post.approved.json +0 -43
  323. data/spec/fixtures/approvals/docs_webhooks_executing_an_unsaved_webhook_options.approved.json +0 -20
  324. data/spec/fixtures/approvals/docs_webhooks_executing_an_unsaved_webhook_post.approved.json +0 -63
  325. data/spec/fixtures/approvals/docs_webhooks_logs_of_triggered_webhook_get.approved.json +0 -20
  326. data/spec/fixtures/approvals/docs_webhooks_logs_of_triggered_webhook_options.approved.json +0 -20
  327. data/spec/fixtures/approvals/docs_webhooks_pact_webhooks_get.approved.json +0 -45
  328. data/spec/fixtures/approvals/docs_webhooks_pact_webhooks_options.approved.json +0 -20
  329. data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_pact_publication_get.approved.json +0 -52
  330. data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_pact_publication_options.approved.json +0 -20
  331. data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_verification_publication_get.approved.json +0 -32
  332. data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_verification_publication_options.approved.json +0 -20
  333. data/spec/fixtures/approvals/docs_webhooks_webhook_get.approved.json +0 -74
  334. data/spec/fixtures/approvals/docs_webhooks_webhook_options.approved.json +0 -20
  335. data/spec/fixtures/approvals/docs_webhooks_webhook_put.approved.json +0 -77
  336. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_a_provider_get.approved.json +0 -41
  337. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_a_provider_options.approved.json +0 -20
  338. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_and_provider_get.approved.json +0 -45
  339. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_and_provider_options.approved.json +0 -20
  340. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_get.approved.json +0 -41
  341. data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_options.approved.json +0 -20
  342. data/spec/fixtures/approvals/docs_webhooks_webhooks_get.approved.json +0 -45
  343. data/spec/fixtures/approvals/docs_webhooks_webhooks_options.approved.json +0 -20
  344. data/spec/fixtures/approvals/docs_webhooks_webhooks_post.approved.json +0 -78
  345. data/spec/fixtures/approvals/docs_webhooks_webhooks_status_get.approved.json +0 -79
  346. data/spec/fixtures/approvals/docs_webhooks_webhooks_status_options.approved.json +0 -20
  347. data/spec/fixtures/approvals/get_provider_pacts_for_verification.approved.json +0 -56
  348. data/spec/fixtures/approvals/matrix_integration_environment_spec.approved.json +0 -62
  349. data/spec/fixtures/approvals/matrix_integration_ignore_spec.approved.json +0 -124
  350. data/spec/fixtures/approvals/matrix_integration_spec.approved.json +0 -173
  351. data/spec/fixtures/approvals/modifiable_resources.approved.json +0 -105
  352. data/spec/fixtures/approvals/publish_contract_no_branch.approved.json +0 -165
  353. data/spec/fixtures/approvals/publish_contract_nothing_exists.approved.json +0 -156
  354. data/spec/fixtures/approvals/publish_contract_nothing_exists_with_webhook.approved.json +0 -156
  355. data/spec/fixtures/approvals/publish_contract_verification_already_exists.approved.json +0 -147
  356. data/spec/fixtures/approvals/publish_contract_with_validation_error.approved.json +0 -41
  357. data/spec/fixtures/approvals/publish_contracts_results_decorator.approved.json +0 -61
  358. data/spec/fixtures/certificate-invalid.pem +0 -29
  359. data/spec/fixtures/certificate.pem +0 -53
  360. data/spec/fixtures/certificates/cacert.pem +0 -21
  361. data/spec/fixtures/certificates/cert.pem +0 -20
  362. data/spec/fixtures/certificates/key.pem +0 -27
  363. data/spec/fixtures/certificates/self-signed.badssl.com.pem +0 -21
  364. data/spec/fixtures/consumer-provider.json +0 -25
  365. data/spec/fixtures/dashboard.json +0 -87
  366. data/spec/fixtures/expected.gv +0 -4
  367. data/spec/fixtures/foo-bar.json +0 -22
  368. data/spec/fixtures/invalid-publish-contract-body.json +0 -38
  369. data/spec/fixtures/renderer_pact.json +0 -34
  370. data/spec/fixtures/update_pacticipant.json +0 -5
  371. data/spec/fixtures/updated_pacticipant.json +0 -11
  372. data/spec/fixtures/verification.json +0 -11
  373. data/spec/fixtures/webhook_valid.json +0 -17
  374. data/spec/fixtures/webhook_valid_with_pacticipants.json +0 -23
  375. data/spec/integration/app_spec.rb +0 -209
  376. data/spec/integration/endpoints/group_spec.rb +0 -19
  377. data/spec/integration/pact_metdata_spec.rb +0 -105
  378. data/spec/integration/ui/index_spec.rb +0 -50
  379. data/spec/integration/ui/matrix_spec.rb +0 -36
  380. data/spec/integration/webhooks/certificate_spec.rb +0 -47
  381. data/spec/integration/webhooks/contract_publication_spec.rb +0 -68
  382. data/spec/integration/webhooks/contract_requiring_verification_published_spec.rb +0 -67
  383. data/spec/integration/webhooks/pact_publication_spec.rb +0 -51
  384. data/spec/integration/webhooks_documentation_spec.rb +0 -348
  385. data/spec/lib/pact/doc/generator_spec.rb +0 -80
  386. data/spec/lib/pact/doc/interaction_view_model_spec.rb +0 -232
  387. data/spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb +0 -71
  388. data/spec/lib/pact/doc/markdown/index_renderer_spec.rb +0 -29
  389. data/spec/lib/pact_broker/api/contracts/environment_schema_spec.rb +0 -91
  390. data/spec/lib/pact_broker/api/contracts/pacticipant_schema_spec.rb +0 -46
  391. data/spec/lib/pact_broker/api/contracts/pacts_for_verification_json_query_schema_combinations_spec.rb +0 -87
  392. data/spec/lib/pact_broker/api/contracts/pacts_for_verification_json_query_schema_spec.rb +0 -358
  393. data/spec/lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema_spec.rb +0 -97
  394. data/spec/lib/pact_broker/api/contracts/publish_contracts_schema_spec.rb +0 -127
  395. data/spec/lib/pact_broker/api/contracts/put_pact_params_contract_spec.rb +0 -133
  396. data/spec/lib/pact_broker/api/contracts/verification_contract_spec.rb +0 -112
  397. data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +0 -379
  398. data/spec/lib/pact_broker/api/decorators/dashboard_decorator_spec.rb +0 -94
  399. data/spec/lib/pact_broker/api/decorators/embedded_label_decorator_spec.rb +0 -34
  400. data/spec/lib/pact_broker/api/decorators/embedded_tag_decorator_spec.rb +0 -41
  401. data/spec/lib/pact_broker/api/decorators/embedded_version_decorator_spec.rb +0 -39
  402. data/spec/lib/pact_broker/api/decorators/extended_pact_decorator_spec.rb +0 -62
  403. data/spec/lib/pact_broker/api/decorators/integration_decorator_spec.rb +0 -86
  404. data/spec/lib/pact_broker/api/decorators/integrations_decorator_spec.rb +0 -29
  405. data/spec/lib/pact_broker/api/decorators/label_decorator_spec.rb +0 -42
  406. data/spec/lib/pact_broker/api/decorators/latest_pact_decorator_spec.rb +0 -25
  407. data/spec/lib/pact_broker/api/decorators/matrix_decorator_spec.rb +0 -259
  408. data/spec/lib/pact_broker/api/decorators/pact_collection_decorator_spec.rb +0 -23
  409. data/spec/lib/pact_broker/api/decorators/pact_decorator_spec.rb +0 -136
  410. data/spec/lib/pact_broker/api/decorators/pact_version_decorator_spec.rb +0 -61
  411. data/spec/lib/pact_broker/api/decorators/pact_webhooks_status_decorator_spec.rb +0 -138
  412. data/spec/lib/pact_broker/api/decorators/pacticipant_collection_decorator_spec.rb +0 -62
  413. data/spec/lib/pact_broker/api/decorators/pacticipant_decorator_spec.rb +0 -89
  414. data/spec/lib/pact_broker/api/decorators/pacts_for_verification_query_decorator_spec.rb +0 -175
  415. data/spec/lib/pact_broker/api/decorators/provider_pacts_decorator_spec.rb +0 -58
  416. data/spec/lib/pact_broker/api/decorators/publish_contracts_results_decorator_spec.rb +0 -53
  417. data/spec/lib/pact_broker/api/decorators/reason_decorator_spec.rb +0 -95
  418. data/spec/lib/pact_broker/api/decorators/relationships_csv_decorator_spec.rb +0 -28
  419. data/spec/lib/pact_broker/api/decorators/representable_pact_spec.rb +0 -29
  420. data/spec/lib/pact_broker/api/decorators/tag_decorator_spec.rb +0 -57
  421. data/spec/lib/pact_broker/api/decorators/tagged_pact_versions_decorator_spec.rb +0 -79
  422. data/spec/lib/pact_broker/api/decorators/triggered_webhook_decorator_spec.rb +0 -69
  423. data/spec/lib/pact_broker/api/decorators/triggered_webhooks_decorator_spec.rb +0 -28
  424. data/spec/lib/pact_broker/api/decorators/verifiable_pact_decorator_spec.rb +0 -94
  425. data/spec/lib/pact_broker/api/decorators/verifiable_pacts_decorator_spec.rb +0 -29
  426. data/spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb +0 -81
  427. data/spec/lib/pact_broker/api/decorators/verification_summary_decorator_spec.rb +0 -65
  428. data/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb +0 -121
  429. data/spec/lib/pact_broker/api/decorators/versions_decorator_spec.rb +0 -49
  430. data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +0 -210
  431. data/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb +0 -128
  432. data/spec/lib/pact_broker/api/decorators/webhook_request_template_decorator_spec.rb +0 -78
  433. data/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb +0 -48
  434. data/spec/lib/pact_broker/api/middleware/basic_auth_spec.rb +0 -312
  435. data/spec/lib/pact_broker/api/middleware/configuration_spec.rb +0 -43
  436. data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +0 -221
  437. data/spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb +0 -141
  438. data/spec/lib/pact_broker/api/renderers/integrations_dot_renderer_spec.rb +0 -29
  439. data/spec/lib/pact_broker/api/resources/all_webhooks_spec.rb +0 -145
  440. data/spec/lib/pact_broker/api/resources/badge_spec.rb +0 -212
  441. data/spec/lib/pact_broker/api/resources/can_i_deploy_badge_spec.rb +0 -80
  442. data/spec/lib/pact_broker/api/resources/can_i_deploy_pacticipant_version_spec.rb +0 -31
  443. data/spec/lib/pact_broker/api/resources/can_i_deploy_spec.rb +0 -51
  444. data/spec/lib/pact_broker/api/resources/dashboard_spec.rb +0 -36
  445. data/spec/lib/pact_broker/api/resources/default_base_resource_approval_spec.rb +0 -60
  446. data/spec/lib/pact_broker/api/resources/default_base_resource_spec.rb +0 -224
  447. data/spec/lib/pact_broker/api/resources/error_response_body_generator_spec.rb +0 -69
  448. data/spec/lib/pact_broker/api/resources/group_spec.rb +0 -82
  449. data/spec/lib/pact_broker/api/resources/latest_pact_spec.rb +0 -80
  450. data/spec/lib/pact_broker/api/resources/latest_provider_pacts_spec.rb +0 -52
  451. data/spec/lib/pact_broker/api/resources/latest_verifications_for_consumer_version_spec.rb +0 -68
  452. data/spec/lib/pact_broker/api/resources/matrix_badge_spec.rb +0 -11
  453. data/spec/lib/pact_broker/api/resources/matrix_spec.rb +0 -42
  454. data/spec/lib/pact_broker/api/resources/pact_spec.rb +0 -178
  455. data/spec/lib/pact_broker/api/resources/pact_triggered_webhooks_spec.rb +0 -54
  456. data/spec/lib/pact_broker/api/resources/pacticipant_spec.rb +0 -60
  457. data/spec/lib/pact_broker/api/resources/pacticipant_webhooks_spec.rb +0 -238
  458. data/spec/lib/pact_broker/api/resources/pacticipants_spec.rb +0 -87
  459. data/spec/lib/pact_broker/api/resources/provider_pacts_for_verification_spec.rb +0 -116
  460. data/spec/lib/pact_broker/api/resources/provider_pacts_spec.rb +0 -75
  461. data/spec/lib/pact_broker/api/resources/released_version_spec.rb +0 -61
  462. data/spec/lib/pact_broker/api/resources/tag_spec.rb +0 -166
  463. data/spec/lib/pact_broker/api/resources/tagged_pact_versions_spec.rb +0 -96
  464. data/spec/lib/pact_broker/api/resources/triggered_webhook_logs_spec.rb +0 -32
  465. data/spec/lib/pact_broker/api/resources/verification_spec.rb +0 -87
  466. data/spec/lib/pact_broker/api/resources/verification_triggered_webhooks_spec.rb +0 -67
  467. data/spec/lib/pact_broker/api/resources/verifications_spec.rb +0 -135
  468. data/spec/lib/pact_broker/api/resources/webhook_execution_spec.rb +0 -92
  469. data/spec/lib/pact_broker/api/resources/webhook_spec.rb +0 -115
  470. data/spec/lib/pact_broker/app_basic_auth_spec.rb +0 -122
  471. data/spec/lib/pact_broker/app_spec.rb +0 -348
  472. data/spec/lib/pact_broker/badges/service_spec.rb +0 -348
  473. data/spec/lib/pact_broker/build_http_options_spec.rb +0 -47
  474. data/spec/lib/pact_broker/certificates/service_spec.rb +0 -80
  475. data/spec/lib/pact_broker/config/load_spec.rb +0 -110
  476. data/spec/lib/pact_broker/config/runtime_configuration_documentation_spec.rb +0 -30
  477. data/spec/lib/pact_broker/config/runtime_configuration_logging_methods_spec.rb +0 -22
  478. data/spec/lib/pact_broker/config/runtime_configuration_spec.rb +0 -71
  479. data/spec/lib/pact_broker/config/save_spec.rb +0 -100
  480. data/spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb +0 -47
  481. data/spec/lib/pact_broker/config/space_delimited_string_list_spec.rb +0 -45
  482. data/spec/lib/pact_broker/configuration_spec.rb +0 -167
  483. data/spec/lib/pact_broker/contracts/service_spec.rb +0 -193
  484. data/spec/lib/pact_broker/db/clean_incremental_spec.rb +0 -120
  485. data/spec/lib/pact_broker/db/clean_old_spec.rb +0 -123
  486. data/spec/lib/pact_broker/db/clean_spec.rb +0 -153
  487. data/spec/lib/pact_broker/db/data_migrations/create_branches_spec.rb +0 -57
  488. data/spec/lib/pact_broker/db/data_migrations/migrate_webhook_headers_spec.rb +0 -78
  489. data/spec/lib/pact_broker/db/data_migrations/set_consumer_ids_for_pact_publications_spec.rb +0 -40
  490. data/spec/lib/pact_broker/db/data_migrations/set_interactions_counts_spec.rb +0 -38
  491. data/spec/lib/pact_broker/db/data_migrations/set_latest_version_sequence_value_spec.rb +0 -68
  492. data/spec/lib/pact_broker/db/data_migrations/set_pacticipant_main_branch_spec.rb +0 -41
  493. data/spec/lib/pact_broker/db/delete_overwritten_data_spec.rb +0 -161
  494. data/spec/lib/pact_broker/db/log_quietener_spec.rb +0 -52
  495. data/spec/lib/pact_broker/db/validate_encoding_spec.rb +0 -66
  496. data/spec/lib/pact_broker/deployments/deployed_version_service_spec.rb +0 -42
  497. data/spec/lib/pact_broker/deployments/deployed_version_spec.rb +0 -109
  498. data/spec/lib/pact_broker/deployments/environment_service_spec.rb +0 -58
  499. data/spec/lib/pact_broker/deployments/environment_spec.rb +0 -27
  500. data/spec/lib/pact_broker/diagnostic/resources/dependencies_spec.rb +0 -85
  501. data/spec/lib/pact_broker/diagnostic/resources/heartbeat_spec.rb +0 -34
  502. data/spec/lib/pact_broker/doc/controllers/app_spec.rb +0 -82
  503. data/spec/lib/pact_broker/doc/coverage_spec.rb +0 -39
  504. data/spec/lib/pact_broker/domain/group_spec.rb +0 -25
  505. data/spec/lib/pact_broker/domain/index_item_spec.rb +0 -24
  506. data/spec/lib/pact_broker/domain/order_versions_spec.rb +0 -84
  507. data/spec/lib/pact_broker/domain/pact_spec.rb +0 -27
  508. data/spec/lib/pact_broker/domain/tag_spec.rb +0 -134
  509. data/spec/lib/pact_broker/domain/verification_spec.rb +0 -133
  510. data/spec/lib/pact_broker/domain/version_spec.rb +0 -490
  511. data/spec/lib/pact_broker/domain/webhook_request_spec.rb +0 -196
  512. data/spec/lib/pact_broker/domain/webhook_spec.rb +0 -168
  513. data/spec/lib/pact_broker/errors/error_logger_spec.rb +0 -65
  514. data/spec/lib/pact_broker/errors_spec.rb +0 -54
  515. data/spec/lib/pact_broker/events/subscriber_spec.rb +0 -43
  516. data/spec/lib/pact_broker/feature_toggle_spec.rb +0 -80
  517. data/spec/lib/pact_broker/groups/service_spec.rb +0 -52
  518. data/spec/lib/pact_broker/hash_refinements_spec.rb +0 -63
  519. data/spec/lib/pact_broker/index/service_spec.rb +0 -400
  520. data/spec/lib/pact_broker/index/service_view_spec.rb +0 -144
  521. data/spec/lib/pact_broker/integrations/integration_spec.rb +0 -108
  522. data/spec/lib/pact_broker/integrations/service_spec.rb +0 -282
  523. data/spec/lib/pact_broker/labels/repository_spec.rb +0 -124
  524. data/spec/lib/pact_broker/labels/service_spec.rb +0 -28
  525. data/spec/lib/pact_broker/matrix/aggregated_row_spec.rb +0 -100
  526. data/spec/lib/pact_broker/matrix/can_i_deploy_query_schema_spec.rb +0 -72
  527. data/spec/lib/pact_broker/matrix/deployment_status_summary_spec.rb +0 -300
  528. data/spec/lib/pact_broker/matrix/every_row_spec.rb +0 -133
  529. data/spec/lib/pact_broker/matrix/head_row_spec.rb +0 -89
  530. data/spec/lib/pact_broker/matrix/integration_environment_spec.rb +0 -187
  531. data/spec/lib/pact_broker/matrix/integration_ignore_spec.rb +0 -238
  532. data/spec/lib/pact_broker/matrix/integration_spec.rb +0 -504
  533. data/spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb +0 -77
  534. data/spec/lib/pact_broker/matrix/parse_query_spec.rb +0 -141
  535. data/spec/lib/pact_broker/matrix/quick_row_spec.rb +0 -74
  536. data/spec/lib/pact_broker/matrix/repository_dependency_spec.rb +0 -56
  537. data/spec/lib/pact_broker/matrix/repository_query_limit_spec.rb +0 -78
  538. data/spec/lib/pact_broker/matrix/repository_spec.rb +0 -888
  539. data/spec/lib/pact_broker/matrix/row_spec.rb +0 -74
  540. data/spec/lib/pact_broker/matrix/service_spec.rb +0 -200
  541. data/spec/lib/pact_broker/messages_spec.rb +0 -29
  542. data/spec/lib/pact_broker/metrics/service_spec.rb +0 -131
  543. data/spec/lib/pact_broker/pacticipants/find_potential_duplicate_pacticipant_names_spec.rb +0 -63
  544. data/spec/lib/pact_broker/pacticipants/generate_display_name_spec.rb +0 -39
  545. data/spec/lib/pact_broker/pacticipants/repository_spec.rb +0 -239
  546. data/spec/lib/pact_broker/pacticipants/service_spec.rb +0 -217
  547. data/spec/lib/pact_broker/pacts/build_verifiable_pact_notices_spec.rb +0 -75
  548. data/spec/lib/pact_broker/pacts/content_spec.rb +0 -447
  549. data/spec/lib/pact_broker/pacts/create_formatted_diff_spec.rb +0 -29
  550. data/spec/lib/pact_broker/pacts/diff_spec.rb +0 -99
  551. data/spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb +0 -45
  552. data/spec/lib/pact_broker/pacts/generate_sha_spec.rb +0 -92
  553. data/spec/lib/pact_broker/pacts/merger_spec.rb +0 -171
  554. data/spec/lib/pact_broker/pacts/metadata_spec.rb +0 -147
  555. data/spec/lib/pact_broker/pacts/pact_params_spec.rb +0 -111
  556. data/spec/lib/pact_broker/pacts/pact_publication_clean_selector_dataset_module_spec.rb +0 -97
  557. data/spec/lib/pact_broker/pacts/pact_publication_dataset_module_spec.rb +0 -499
  558. data/spec/lib/pact_broker/pacts/pact_publication_latest_verification_spec.rb +0 -29
  559. data/spec/lib/pact_broker/pacts/pact_publication_selector_dataset_module_spec.rb +0 -185
  560. data/spec/lib/pact_broker/pacts/pact_publication_spec.rb +0 -559
  561. data/spec/lib/pact_broker/pacts/pact_version_spec.rb +0 -343
  562. data/spec/lib/pact_broker/pacts/repository_find_for_currently_deployed_spec.rb +0 -124
  563. data/spec/lib/pact_broker/pacts/repository_find_for_currently_supported_releases_spec.rb +0 -159
  564. data/spec/lib/pact_broker/pacts/repository_find_for_verification_fallback_spec.rb +0 -87
  565. data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +0 -380
  566. data/spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_branch_spec.rb +0 -282
  567. data/spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb +0 -375
  568. data/spec/lib/pact_broker/pacts/repository_spec.rb +0 -1079
  569. data/spec/lib/pact_broker/pacts/selected_pact_spec.rb +0 -23
  570. data/spec/lib/pact_broker/pacts/selector_spec.rb +0 -77
  571. data/spec/lib/pact_broker/pacts/selectors_spec.rb +0 -30
  572. data/spec/lib/pact_broker/pacts/service_spec.rb +0 -355
  573. data/spec/lib/pact_broker/pacts/sort_content_spec.rb +0 -57
  574. data/spec/lib/pact_broker/pacts/squash_pacts_for_verification_spec.rb +0 -70
  575. data/spec/lib/pact_broker/pacts/verifiable_pact_messages_spec.rb +0 -253
  576. data/spec/lib/pact_broker/pacts/verifiable_pact_spec.rb +0 -0
  577. data/spec/lib/pact_broker/relationships/groupify_spec.rb +0 -43
  578. data/spec/lib/pact_broker/tags/repository_spec.rb +0 -144
  579. data/spec/lib/pact_broker/tags/service_spec.rb +0 -66
  580. data/spec/lib/pact_broker/ui/controllers/can_i_deploy_spec.rb +0 -26
  581. data/spec/lib/pact_broker/ui/controllers/clusters_spec.rb +0 -27
  582. data/spec/lib/pact_broker/ui/controllers/index_spec.rb +0 -132
  583. data/spec/lib/pact_broker/ui/view_models/index_item_spec.rb +0 -173
  584. data/spec/lib/pact_broker/ui/view_models/index_items_spec.rb +0 -35
  585. data/spec/lib/pact_broker/ui/view_models/matrix_deployed_version_spec.rb +0 -29
  586. data/spec/lib/pact_broker/ui/view_models/matrix_line_spec.rb +0 -41
  587. data/spec/lib/pact_broker/verifications/pseudo_branch_status_spec.rb +0 -56
  588. data/spec/lib/pact_broker/verifications/repository_spec.rb +0 -350
  589. data/spec/lib/pact_broker/verifications/sequence_spec.rb +0 -73
  590. data/spec/lib/pact_broker/verifications/service_spec.rb +0 -266
  591. data/spec/lib/pact_broker/verifications/summary_for_consumer_version_spec.rb +0 -72
  592. data/spec/lib/pact_broker/versions/abbreviate_number_spec.rb +0 -23
  593. data/spec/lib/pact_broker/versions/branch_service_spec.rb +0 -71
  594. data/spec/lib/pact_broker/versions/branch_version_repository_spec.rb +0 -81
  595. data/spec/lib/pact_broker/versions/branch_version_spec.rb +0 -27
  596. data/spec/lib/pact_broker/versions/parse_semantic_version_spec.rb +0 -42
  597. data/spec/lib/pact_broker/versions/repository_spec.rb +0 -302
  598. data/spec/lib/pact_broker/versions/service_spec.rb +0 -137
  599. data/spec/lib/pact_broker/webhooks/check_host_whitelist_spec.rb +0 -85
  600. data/spec/lib/pact_broker/webhooks/execution_configuration_spec.rb +0 -18
  601. data/spec/lib/pact_broker/webhooks/job_spec.rb +0 -188
  602. data/spec/lib/pact_broker/webhooks/pact_and_verification_parameters_spec.rb +0 -16
  603. data/spec/lib/pact_broker/webhooks/redact_logs_spec.rb +0 -60
  604. data/spec/lib/pact_broker/webhooks/render_spec.rb +0 -221
  605. data/spec/lib/pact_broker/webhooks/repository_spec.rb +0 -933
  606. data/spec/lib/pact_broker/webhooks/service_spec.rb +0 -184
  607. data/spec/lib/pact_broker/webhooks/status_spec.rb +0 -54
  608. data/spec/lib/pact_broker/webhooks/trigger_service_spec.rb +0 -461
  609. data/spec/lib/pact_broker/webhooks/triggered_webhook_spec.rb +0 -40
  610. data/spec/lib/pact_broker/webhooks/webhook_request_logger_spec.rb +0 -207
  611. data/spec/lib/pact_broker/webhooks/webhook_request_template_spec.rb +0 -227
  612. data/spec/lib/pact_broker/webhooks/webhook_spec.rb +0 -39
  613. data/spec/lib/rack/hal_browser/redirect_spec.rb +0 -63
  614. data/spec/lib/rack/pact_broker/add_pact_broker_version_header_spec.rb +0 -16
  615. data/spec/lib/rack/pact_broker/database_transaction_spec.rb +0 -77
  616. data/spec/lib/rack/pact_broker/invalid_uri_protection_spec.rb +0 -50
  617. data/spec/lib/rack/pact_broker/request_target_spec.rb +0 -69
  618. data/spec/lib/rack/pact_broker/set_base_url_spec.rb +0 -86
  619. data/spec/lib/rack/pact_broker/use_when_spec.rb +0 -49
  620. data/spec/lib/sequel/plugins/insert_ignore_spec.rb +0 -82
  621. data/spec/lib/sequel/plugins/upsert_spec.rb +0 -159
  622. data/spec/lib/webmachine/rack_adapter_monkey_patch_spec.rb +0 -49
  623. data/spec/migrations/20180201_create_head_matrix_spec.rb +0 -132
  624. data/spec/migrations/23_pact_versions_spec.rb +0 -77
  625. data/spec/migrations/24_populate_pact_contents_spec.rb +0 -22
  626. data/spec/migrations/34_latest_tagged_pacts_spec.rb +0 -84
  627. data/spec/migrations/34_pact_revisions_spec.rb +0 -82
  628. data/spec/migrations/41_migrate_execution_data_spec.rb +0 -109
  629. data/spec/migrations/42_delete_ophan_webhook_data_spec.rb +0 -98
  630. data/spec/migrations/44_add_provider_version_to_verification_spec.rb +0 -56
  631. data/spec/migrations/50_create_latest_matrix_spec.rb +0 -181
  632. data/spec/migrations/change_migration_strategy_spec.rb +0 -85
  633. data/spec/migrations/rollback_spec.rb +0 -8
  634. data/spec/service_consumers/hal_relation_proxy_app.rb +0 -61
  635. data/spec/service_consumers/pact_helper.rb +0 -61
  636. data/spec/service_consumers/provider_states_for_pact_broker_client.rb +0 -341
  637. data/spec/service_consumers/provider_states_for_pact_broker_client_2.rb +0 -36
  638. data/spec/service_consumers/provider_states_for_pact_ruby.rb +0 -158
  639. data/spec/spec_helper.rb +0 -65
  640. data/spec/support/approvals.rb +0 -55
  641. data/spec/support/database.rb +0 -9
  642. data/spec/support/database_cleaner.rb +0 -44
  643. data/spec/support/documentation.rb +0 -64
  644. data/spec/support/fixture_helpers.rb +0 -10
  645. data/spec/support/fixture_pact.rb +0 -34
  646. data/spec/support/foo-bar.json +0 -34
  647. data/spec/support/generated_index.md +0 -4
  648. data/spec/support/generated_markdown.md +0 -55
  649. data/spec/support/interaction_view_model.json +0 -63
  650. data/spec/support/interaction_view_model_with_terms.json +0 -50
  651. data/spec/support/logging.rb +0 -6
  652. data/spec/support/markdown_pact.json +0 -48
  653. data/spec/support/markdown_pact_v3.json +0 -44
  654. data/spec/support/markdown_pact_with_html.json +0 -27
  655. data/spec/support/markdown_pact_with_markdown_chars_in_names.json +0 -11
  656. data/spec/support/metadata_test_server.rb +0 -40
  657. data/spec/support/migration_helpers.rb +0 -16
  658. data/spec/support/rack_helpers.rb +0 -20
  659. data/spec/support/rspec_match_hash.rb +0 -26
  660. data/spec/support/rspec_matchers.rb +0 -9
  661. data/spec/support/shared_context.rb +0 -32
  662. data/spec/support/shared_examples_for_responses.rb +0 -96
  663. data/spec/support/simplecov.rb +0 -23
  664. data/spec/support/ssl_pact_broker_server.rb +0 -46
  665. data/spec/support/ssl_webhook_server.rb +0 -39
  666. data/spec/support/test_data_builder.rb +0 -3
  667. data/spec/support/verification_job.rb +0 -37
  668. data/spec/support/warning_silencer.rb +0 -10
  669. data/spec/support/webhook_endpoint_middleware.rb +0 -22
  670. data/tasks/audit.rake +0 -6
  671. data/tasks/database/annotate.rb +0 -48
  672. data/tasks/database/table_dependency_calculator.rb +0 -8
  673. data/tasks/database.rb +0 -161
  674. data/tasks/db.rake +0 -147
  675. data/tasks/development.rake +0 -52
  676. data/tasks/docker_database.rb +0 -26
  677. data/tasks/pact.rake +0 -16
  678. data/tasks/release.rake +0 -6
  679. data/tasks/rspec.rake +0 -32
  680. data/tasks/test_db.rake +0 -32
  681. data/vendor/hal-browser/.gitignore +0 -1
@@ -1,933 +0,0 @@
1
- require "spec_helper"
2
- require "pact_broker/webhooks/repository"
3
-
4
- module PactBroker
5
- module Webhooks
6
- describe Repository do
7
- let(:url) { "http://example.org" }
8
- let(:body) { {"some" => "json" } }
9
- let(:headers) { {"Content-Type" => "application/json", "Accept" => "application/json"} }
10
- let(:request) do
11
- Webhooks::WebhookRequestTemplate.new(
12
- method: "post",
13
- url: url,
14
- headers: headers,
15
- username: "username",
16
- password: "password",
17
- body: body)
18
- end
19
- let(:event) do
20
- PactBroker::Webhooks::WebhookEvent.new(name: "something_happened")
21
- end
22
- let(:events) { [event]}
23
- let(:webhook) { Domain::Webhook.new(request: request, events: events) }
24
- let(:consumer) { td.create_pacticipant("Consumer").and_return(:pacticipant) }
25
- let(:provider) { td.create_pacticipant("Provider").and_return(:pacticipant) }
26
- let(:webhook_consumer) { Domain::WebhookPacticipant.new(name: consumer.name) }
27
- let(:webhook_provider) { Domain::WebhookPacticipant.new(name: provider.name) }
28
- let(:uuid) { "the-uuid" }
29
- let(:created_webhook_record) { ::DB::PACT_BROKER_DB[:webhooks].order(:id).last }
30
- let(:created_events) { ::DB::PACT_BROKER_DB[:webhook_events].where(webhook_id: created_webhook_record[:id]).order(:name).all }
31
- let(:expected_webhook_record) do
32
- {
33
- uuid: "the-uuid",
34
- method: "post",
35
- url: "http://example.org",
36
- username: "username",
37
- password: "cGFzc3dvcmQ=",
38
- body: body.to_json,
39
- consumer_id: consumer.id,
40
- provider_id: provider.id
41
- }
42
- end
43
-
44
- describe "#create" do
45
- subject { Repository.new.create(uuid, webhook, consumer, provider) }
46
-
47
- it "saves webhook" do
48
- subject
49
- expect(created_webhook_record).to include expected_webhook_record
50
- end
51
-
52
- it "saves the webhook headers as JSON" do
53
- subject
54
- expect(JSON.parse(created_webhook_record[:headers])).to eq headers
55
- end
56
-
57
- it "saves the webhook events" do
58
- expect(subject.events.first[:name]).to eq "something_happened"
59
- end
60
-
61
- context "when consumer and provider domain objects are set on the object rather than passed in" do
62
- let(:webhook) { Domain::Webhook.new(request: request, events: events, consumer: webhook_consumer, provider: webhook_provider) }
63
-
64
- subject { Repository.new.create(uuid, webhook, nil, nil) }
65
-
66
- it "sets the consumer and provider relationships" do
67
- expect(subject.consumer.name).to eq consumer.name
68
- expect(subject.provider.name).to eq provider.name
69
- end
70
- end
71
- end
72
-
73
- describe "delete_by_uuid" do
74
- before do
75
- Repository.new.create uuid, webhook, consumer, provider
76
- Repository.new.create "another-uuid", webhook, consumer, provider
77
- end
78
-
79
- subject { Repository.new.delete_by_uuid(uuid) }
80
-
81
- it "deletes the webhook" do
82
- expect { subject }.to change { ::DB::PACT_BROKER_DB[:webhooks].where(uuid: uuid).count }.by(-1)
83
- end
84
- end
85
-
86
- describe "delete_by_pacticipant" do
87
- before do
88
- td.create_consumer("other-consumer")
89
- .create_provider("other-provider")
90
- .create_consumer_version
91
- .create_pact
92
- .create_webhook(uuid: "other-uuid")
93
- .create_triggered_webhook
94
- .create_webhook_execution
95
- .create_consumer("foo")
96
- .create_provider("bar")
97
- .create_consumer_version
98
- .create_pact
99
- .create_webhook(uuid: "1234")
100
- .create_triggered_webhook
101
- .create_webhook_execution
102
- .create_webhook(uuid: "5555")
103
- .create_triggered_webhook
104
- .create_webhook_execution
105
- # simulate resource already deleted
106
- Webhook.where(uuid: "5555").delete
107
- end
108
-
109
- context "when the pacticipant is the consumer" do
110
-
111
- subject { Repository.new.delete_by_pacticipant td.consumer }
112
-
113
- it "deletes the matching webhook" do
114
- expect { subject }.to change { Webhook.where(uuid: "1234").count }.by(-1)
115
- end
116
-
117
- it "does not delete the unmatching webhooks" do
118
- expect { subject }.to change { Webhook.count }.by(-1)
119
- end
120
-
121
- it "deletes the triggered webhooks" do
122
- expect { subject }.to change { TriggeredWebhook.count }.by(-2)
123
- end
124
- end
125
-
126
- context "when the pacticipant is the provider" do
127
- subject { Repository.new.delete_by_pacticipant(td.provider) }
128
-
129
- it "deletes the matching webhooks" do
130
- expect { subject }.to change { Webhook.where(uuid: "1234").count }.by(-1)
131
- end
132
-
133
- it "does not delete the unmatching webhooks" do
134
- expect { subject }.to change { Webhook.count }.by(-1)
135
- end
136
-
137
- it "deletes the triggered webhooks" do
138
- expect { subject }.to change { TriggeredWebhook.count }.by(-2)
139
- end
140
- end
141
- end
142
-
143
- describe "delete_by_consumer_and_provider" do
144
- before do
145
- td.create_consumer("foo")
146
- .create_provider("other-provider")
147
- .create_consumer_version
148
- .create_pact
149
- .create_webhook(uuid: "other-uuid")
150
- .comment("kept because doesn't match provider")
151
- .create_triggered_webhook
152
- .create_webhook_execution
153
- .create_provider("bar")
154
- .create_consumer_version
155
- .create_pact
156
- .create_webhook(uuid: "1234")
157
- .create_triggered_webhook
158
- .create_webhook_execution
159
- .create_webhook(uuid: "5555")
160
- .create_triggered_webhook
161
- .create_webhook_execution
162
- # simulate resource already deleted
163
- Webhook.where(uuid: "5555").delete
164
- end
165
-
166
- subject { Repository.new.delete_by_consumer_and_provider(td.consumer, td.provider) }
167
-
168
- it "deletes the webhooks that match both consumer and provider" do
169
- expect { subject }.to change { Webhook.where(uuid: "1234").count }.by(-1)
170
- end
171
-
172
- it "does not delete the unmatching webhooks" do
173
- expect { subject }.to change { Webhook.count }.by(-1)
174
- end
175
-
176
- it "deletes the triggered webhooks" do
177
- expect { subject }.to change { TriggeredWebhook.count }.by(-2)
178
- end
179
- end
180
-
181
- describe "find_by_uuid" do
182
- subject { Repository.new.find_by_uuid(uuid) }
183
-
184
- context "when a webhook is found" do
185
- before do
186
- Repository.new.create uuid, webhook, consumer, provider
187
- end
188
-
189
- it "returns a webhook with the consumer set" do
190
- expect(subject.consumer.name).to eq consumer.name
191
- end
192
-
193
- it "returns a webhook with the provider set" do
194
- expect(subject.provider.name).to eq provider.name
195
- end
196
-
197
- it "returns a webhook with the uuid set" do
198
- expect(subject.uuid).to eq uuid
199
- end
200
-
201
- it "returns a webhook with the body set" do
202
- expect(subject.request.body).to eq body
203
- end
204
-
205
- it "returns a webhook with the headers set" do
206
- expect(subject.request.headers).to eq headers
207
- end
208
-
209
- it "returns a webhook with the username set" do
210
- expect(subject.request.username).to eq "username"
211
- end
212
-
213
- it "returns a webhook with the password set" do
214
- expect(subject.request.password).to eq "password"
215
- end
216
-
217
- it "returns a webhook with the url set" do
218
- expect(subject.request.url).to eq url
219
- end
220
-
221
- it "returns a webhook with a created_at date" do
222
- expect(subject.created_at).to be_datey
223
- end
224
-
225
- it "returns a webhook with a updated_at date" do
226
- expect(subject.updated_at).to be_datey
227
- end
228
-
229
- context "when the body is a XML string" do
230
- let(:body) { "<xml>Why would you do this?</xml>" }
231
-
232
- it "returns the body as the XML String, not an JSON Object" do
233
- expect(subject.request.body).to eq body
234
- end
235
- end
236
-
237
- context "when the optional attributes are nil" do
238
- let(:body) { nil }
239
- let(:headers) { nil }
240
-
241
- it "does not blow up" do
242
- expect(subject.request.body).to eq body
243
- expect(subject.request.headers).to eq({})
244
- end
245
- end
246
- end
247
-
248
- context "when a webhook is not found" do
249
- it "returns nil" do
250
- expect(subject).to be nil
251
- end
252
- end
253
-
254
- end
255
-
256
- describe "update_by_uuid" do
257
- before do
258
- td.create_consumer("Foo")
259
- .create_provider
260
- .create_webhook(old_webhook_params)
261
- .create_consumer("Foo2")
262
- end
263
-
264
- let(:uuid) { "1234" }
265
- let(:old_webhook_params) do
266
- {
267
- events: [{ name: "something" }],
268
- uuid: uuid,
269
- method: "POST",
270
- url: "http://example.org",
271
- body: '{"foo":1}',
272
- headers: {"Content-Type" => "application/json"},
273
- username: "username",
274
- password: "password"
275
- }
276
- end
277
- let(:new_request_webhook_params) do
278
- {
279
- method: "GET",
280
- url: "http://example.com",
281
- body: "foo",
282
- headers: {"Content-Type" => "text/plain"}
283
- }
284
- end
285
- let(:new_request) { PactBroker::Domain::WebhookRequest.new(new_request_webhook_params) }
286
- let(:new_event) do
287
- PactBroker::Webhooks::WebhookEvent.new(name: "something_else")
288
- end
289
- let(:new_consumer) { Domain::WebhookPacticipant.new(name: "Foo2") }
290
- let(:new_webhook) do
291
- PactBroker::Domain::Webhook.new(
292
- consumer: new_consumer,
293
- events: [new_event],
294
- request: new_request
295
- )
296
- end
297
-
298
- subject { Repository.new.update_by_uuid(uuid, new_webhook) }
299
-
300
- it "updates the webhook" do
301
- expect(subject.uuid).to eq uuid
302
- expect(subject.request.method).to eq "GET"
303
- expect(subject.request.url).to eq "http://example.com"
304
- expect(subject.request.body).to eq "foo"
305
- expect(subject.request.headers).to eq "Content-Type" => "text/plain"
306
- expect(subject.request.username).to eq nil
307
- expect(subject.request.password).to eq nil
308
- expect(subject.events.first.name).to eq "something_else"
309
- expect(subject.consumer.name).to eq "Foo2"
310
- end
311
-
312
- context "when the updated params do not contain a consumer or provider" do
313
- let(:new_webhook) do
314
- PactBroker::Domain::Webhook.new(
315
- events: [new_event],
316
- request: new_request
317
- )
318
- end
319
-
320
- it "removes the existing consumer or provider" do
321
- expect(subject.consumer).to be nil
322
- end
323
- end
324
- end
325
-
326
- describe "find_all" do
327
- before do
328
- allow(PactBroker).to receive(:policy_scope!).and_call_original
329
- Repository.new.create uuid, webhook, consumer, provider
330
- Repository.new.create "some-other-uuid", webhook, consumer, provider
331
- end
332
-
333
- subject { Repository.new.find_all }
334
-
335
- it "returns a list of webhooks" do
336
- expect(subject.size).to be 2
337
- expect(subject.first).to be_instance_of Domain::Webhook
338
- end
339
-
340
- it "uses the policy" do
341
- expect(PactBroker).to receive(:policy_scope!)
342
- subject
343
- end
344
- end
345
-
346
- describe "find_by_consumer_and_provider" do
347
- let(:consumer) { td.consumer }
348
- let(:provider) { td.provider }
349
-
350
- subject { Repository.new.find_by_consumer_and_provider(consumer, provider) }
351
-
352
- context "when a webhook exists with a matching consumer and provider" do
353
- before do
354
- td.create_consumer("Consumer")
355
- .create_provider("Another Provider")
356
- .create_webhook
357
- .create_provider("Provider")
358
- .create_webhook
359
- end
360
-
361
- it "returns an array of webhooks" do
362
- expect(subject).to be_instance_of Array
363
- expect(subject.first.uuid).to eq td.webhook.uuid
364
- end
365
- end
366
-
367
- context "when a webhook does not exist with a matching consumer and provider" do
368
- before do
369
- td
370
- .create_consumer("Consumer")
371
- .create_provider("Provider")
372
- .create_webhook
373
- .create_provider("Another Provider")
374
- end
375
-
376
- it "returns an empty array" do
377
- expect(subject).to eq []
378
- end
379
- end
380
-
381
- context "when the consumer argument is nil" do
382
- let(:consumer) { nil }
383
-
384
- before do
385
- td.create_provider("Provider")
386
- .create_consumer("Consumer")
387
- .create_provider_webhook
388
- .create_webhook
389
- end
390
-
391
- it "returns all the webhooks where the provider matches and the consumer id is nil" do
392
- expect(subject.size).to be 1
393
- expect(subject.first.consumer).to be nil
394
- expect(subject.first.provider).to_not be nil
395
- end
396
- end
397
-
398
- context "when the provider argument is nil" do
399
- let(:provider) { nil }
400
-
401
- before do
402
- td.create_consumer("Consumer")
403
- .create_provider("Provider")
404
- .create_consumer_webhook
405
- .create_webhook
406
- end
407
-
408
- it "returns all the webhooks where the consumer matches and the provider id is nil" do
409
- expect(subject.size).to be 1
410
- expect(subject.first.provider).to be nil
411
- expect(subject.first.consumer).to_not be nil
412
- end
413
- end
414
- end
415
-
416
- describe "find_webhooks_to_trigger" do
417
- before do
418
- allow(PactBroker).to receive(:policy_scope!).and_call_original
419
- end
420
-
421
- let(:enabled) { true }
422
-
423
- subject { Repository.new.find_webhooks_to_trigger(consumer: td.consumer, provider: td.provider, event_name: "contract_published") }
424
-
425
- it "does not use a policy" do
426
- td.create_webhook(event_names: ["contract_published"], enabled: enabled, description: "Enabled webhook")
427
- .create_consumer("Foo")
428
- .create_provider("Bar")
429
- expect(PactBroker).to_not receive(:policy_scope!)
430
- is_expected.to contain_exactly(
431
- have_attributes(description: "Enabled webhook")
432
- )
433
- end
434
-
435
- context "when the webhook is disabled" do
436
- before do
437
- td.create_webhook(event_names: ["contract_published"], enabled: enabled)
438
- .create_consumer("Foo")
439
- .create_provider("Bar")
440
- end
441
- let(:enabled) { false }
442
-
443
- it "finds no webhooks to trigger" do
444
- is_expected.to be_empty
445
- end
446
- end
447
-
448
- context "when the webhook is specified for a consumer and all providers" do
449
- before do
450
- td.create_consumer("Foo1")
451
- .create_provider("Bar1")
452
- .create_webhook(provider: nil, event_names: ["contract_published"], description: "Right webhook")
453
- end
454
-
455
- let(:webhook_consumer) { Domain::WebhookPacticipant.new(name: td.consumer.name) }
456
-
457
- it "finds one webhook to trigger" do
458
- is_expected.to contain_exactly(
459
- have_attributes(description: "Right webhook")
460
- )
461
- end
462
- end
463
-
464
- context "when the webhook is specified for matching consumer but not provider" do
465
- before do
466
- td.create_consumer("Foo1")
467
- .create_provider("Bar1")
468
- .create_webhook(event_names: ["contract_published"])
469
- .create_provider("Bar3")
470
- end
471
-
472
- it "finds no webhooks to trigger" do
473
- is_expected.to be_empty
474
- end
475
- end
476
-
477
- context "when the webhook is specified for matching consumer label" do
478
- before do
479
- td.create_webhook(
480
- event_names: ["contract_published"],
481
- consumer_label: "my_label",
482
- description: "Labeled webhook"
483
- )
484
- .create_consumer("Consumer")
485
- .create_label("my_label")
486
- .create_provider("Provider")
487
- end
488
-
489
- it "finds one webhook to trigger" do
490
- is_expected.to contain_exactly(
491
- have_attributes(description: "Labeled webhook")
492
- )
493
- end
494
- end
495
-
496
- context "when the webhook is specified for matching consumer label and specific provider" do
497
- before do
498
- td.create_provider("Provider")
499
- .create_webhook(
500
- event_names: ["contract_published"],
501
- consumer_label: "my_label",
502
- description: "Labeled webhook"
503
- )
504
- .create_consumer("Consumer")
505
- .create_label("my_label")
506
- end
507
-
508
- it "finds one webhook to trigger" do
509
- is_expected.to contain_exactly(
510
- have_attributes(description: "Labeled webhook")
511
- )
512
- end
513
- end
514
-
515
- context "when the webhook is specified for consumer label that does not match" do
516
- before do
517
- td.create_webhook(event_names: ["contract_published"], consumer_label: "my_label")
518
- .create_consumer("Consumer")
519
- .create_label("other_label")
520
- .create_provider("Provider")
521
- end
522
-
523
- it "finds no webhooks to trigger" do
524
- is_expected.to be_empty
525
- end
526
- end
527
-
528
- context "when the webhook is specified for matching provider label" do
529
- before do
530
- td.create_webhook(
531
- event_names: ["contract_published"],
532
- provider_label: "my_label",
533
- description: "Labeled webhook"
534
- )
535
- .create_consumer("Consumer")
536
- .create_provider("Provider")
537
- .create_label("my_label")
538
- end
539
-
540
- it "finds one webhook to trigger" do
541
- is_expected.to contain_exactly(
542
- have_attributes(description: "Labeled webhook")
543
- )
544
- end
545
- end
546
-
547
- context "when the webhook is specified for matching provider label and specific consumer" do
548
- before do
549
- td.create_consumer("Consumer")
550
- .create_webhook(
551
- event_names: ["contract_published"],
552
- provider_label: "my_label",
553
- description: "Labeled webhook"
554
- )
555
- .create_provider("Provider")
556
- .create_label("my_label")
557
- end
558
-
559
- it "finds one webhook to trigger" do
560
- is_expected.to contain_exactly(
561
- have_attributes(description: "Labeled webhook")
562
- )
563
- end
564
- end
565
-
566
- context "when the webhook is specified for provider label that does not match" do
567
- before do
568
- td.create_webhook(event_names: ["contract_published"], provider_label: "my_label")
569
- .create_consumer("Consumer")
570
- .create_provider("Provider")
571
- .create_label("other_label")
572
- end
573
-
574
- it "find no webhooks to trigger" do
575
- is_expected.to be_empty
576
- end
577
- end
578
-
579
- context "when the webhook is specified for consumer and provider label" do
580
- before do
581
- td.create_webhook(
582
- event_names: ["contract_published"],
583
- consumer_label: "clabel",
584
- provider_label: "plabel",
585
- description: "Labeled webhook"
586
- )
587
- .create_webhook(
588
- event_names: ["contract_published"],
589
- consumer_label: "clabel",
590
- provider_label: "plabel2",
591
- description: "Labeled consumer webhook"
592
- )
593
- .create_webhook(
594
- event_names: ["contract_published"],
595
- consumer_label: "clabel2",
596
- provider_label: "plabel",
597
- description: "Labeled provider webhook"
598
- )
599
- .create_consumer("Consumer")
600
- .create_label("clabel")
601
- .create_provider("Provider")
602
- .create_label("plabel")
603
- end
604
-
605
- it "finds one webhook to trigger" do
606
- is_expected.to contain_exactly(
607
- have_attributes(description: "Labeled webhook")
608
- )
609
- end
610
- end
611
- end
612
-
613
- describe "create_triggered_webhook" do
614
- before do
615
- td.create_consumer
616
- .create_provider
617
- .create_webhook
618
- .create_consumer_version
619
- .create_pact
620
- .create_verification
621
- end
622
-
623
- let(:event_context) { { "some" => "info" } }
624
-
625
- subject { Repository.new.create_triggered_webhook "1234", td.webhook, td.pact, td.verification, "publication", "some_event", event_context }
626
-
627
- it "creates a TriggeredWebhook" do
628
- expect(subject.webhook_uuid ).to eq td.webhook.uuid
629
- expect(subject.consumer).to eq td.consumer
630
- expect(subject.provider).to eq td.provider
631
- expect(subject.verification).to eq td.verification
632
- expect(subject.uuid).to eq "1234"
633
- expect(subject.trigger_type).to eq "publication"
634
- expect(subject.event_name).to eq "some_event"
635
- expect(subject.event_context).to eq event_context
636
- end
637
-
638
- it "sets the webhook" do
639
- expect(subject.webhook.uuid).to eq td.webhook.uuid
640
- end
641
-
642
- it "sets the webhook_uuid" do
643
- expect(subject.webhook_uuid).to eq td.webhook.uuid
644
- end
645
-
646
- it "sets the consumer" do
647
- expect(subject.consumer).to eq td.consumer
648
- end
649
-
650
- it "sets the provider" do
651
- expect(subject.provider).to eq td.provider
652
- end
653
-
654
- it "sets the PactPublication" do
655
- expect(subject.pact_publication.id).to eq td.pact.id
656
- end
657
-
658
- context "without a verification" do
659
- subject { Repository.new.create_triggered_webhook "1234", td.webhook, td.pact, nil, "publication", "some_event", {} }
660
-
661
- it "does not set the verification" do
662
- expect(subject.verification).to be nil
663
- end
664
- end
665
- end
666
-
667
- describe "create_execution" do
668
- before do
669
- td.create_consumer
670
- .create_provider
671
- .create_consumer_version
672
- .create_pact
673
- .create_webhook
674
- .create_triggered_webhook
675
- end
676
-
677
- let(:webhook_domain) { Repository.new.find_by_uuid td.webhook.uuid }
678
- let(:webhook_execution_result) { instance_double("PactBroker::Domain::WebhookExecutionResult", success?: true, logs: "logs") }
679
- let(:repository) { Repository.new }
680
-
681
- subject { repository.create_execution td.triggered_webhook, webhook_execution_result }
682
-
683
- it "saves a new webhook execution " do
684
- expect { subject }.to change { Execution.count }.by(1)
685
- end
686
-
687
- it "sets the success" do
688
- expect(subject.success).to be true
689
- end
690
-
691
- it "sets the logs" do
692
- expect(subject.logs).to eq "logs"
693
- end
694
-
695
- context "when the triggered webhook has been deleted in the meantime" do
696
- before do
697
- TriggeredWebhook.where(id: td.triggered_webhook.id).delete
698
- allow(repository).to receive(:logger).and_return(logger)
699
- end
700
-
701
- let(:logger) { double("logger") }
702
-
703
- it "just logs the error" do
704
- expect(logger).to receive(:info).with(/triggered webhook with id #{td.triggered_webhook.id}/)
705
- subject
706
- end
707
- end
708
- end
709
-
710
- describe "find_latest_triggered_webhooks" do
711
- before do
712
- td
713
- .create_pact_with_hierarchy("Foo", "1.0.0", "Bar")
714
- .create_webhook
715
- .create_triggered_webhook
716
- .create_webhook_execution
717
- .create_pact_with_hierarchy
718
- .create_webhook(uuid: "123")
719
- .create_triggered_webhook(uuid: "256", created_at: DateTime.new(2016))
720
- .create_webhook_execution
721
- .create_triggered_webhook(uuid: "332", created_at: DateTime.new(2017))
722
- .create_webhook_execution
723
- .create_webhook(uuid: "987")
724
- .create_triggered_webhook(uuid: "876", created_at: DateTime.new(2017))
725
- .create_webhook_execution
726
- .create_triggered_webhook(uuid: "638", created_at: DateTime.new(2018))
727
- .create_webhook_execution
728
- end
729
-
730
- subject { Repository.new.find_latest_triggered_webhooks(td.consumer, td.provider) }
731
-
732
- it "finds the latest triggered webhooks" do
733
- expect(subject.collect(&:uuid).sort).to eq ["332", "638"]
734
- end
735
-
736
- context "when a webhook has been triggered by different events" do
737
- before do
738
- td.create_pact_with_hierarchy("Foo2", "1.0.0", "Bar2")
739
- .create_webhook
740
- .create_triggered_webhook(uuid: "333", event_name: "foo")
741
- .create_triggered_webhook(uuid: "555", event_name: "foo")
742
- .create_webhook_execution
743
- .create_triggered_webhook(uuid: "444", event_name: "bar")
744
- .create_triggered_webhook(uuid: "777", event_name: "bar")
745
- .create_webhook_execution
746
- .create_triggered_webhook(uuid: "111", event_name: nil)
747
- .create_triggered_webhook(uuid: "888", event_name: nil)
748
- .create_webhook_execution
749
- end
750
-
751
- it "returns one for each event" do
752
- # ignoring the ones with nil event_names because they're old data, and shouldn't be
753
- # considered as a separate "group"
754
- expect(subject.collect(&:uuid).sort).to eq ["555", "777"]
755
- end
756
- end
757
-
758
- context "when there are two 'latest' triggered webhooks at the same time" do
759
- before do
760
- td.create_triggered_webhook(uuid: "888", created_at: DateTime.new(2018))
761
- .create_webhook_execution
762
- end
763
-
764
- it "returns the one with the bigger ID" do
765
- expect(subject.collect(&:uuid).sort).to eq ["332", "888"]
766
- end
767
- end
768
-
769
- context "when there are no triggered webhooks for the given consumer and provider" do
770
- before do
771
- td.create_consumer
772
- .create_provider
773
- end
774
-
775
- it "returns an empty list" do
776
- expect(subject).to be_empty
777
- end
778
- end
779
- end
780
-
781
- describe "find_latest_triggered_webhooks_for_pact" do
782
- before do
783
- td
784
- .create_pact_with_hierarchy("Foo", "1.0.0", "Bar")
785
- .create_webhook
786
- .create_triggered_webhook
787
- .create_webhook_execution
788
- .create_pact_with_hierarchy
789
- .create_webhook
790
- .create_triggered_webhook(uuid: "256", created_at: DateTime.new(2016))
791
- .create_webhook_execution
792
- .create_triggered_webhook(uuid: "332", created_at: DateTime.new(2017))
793
- .create_webhook_execution
794
- .create_provider_webhook(uuidd: "987")
795
- .create_triggered_webhook(uuid: "876", created_at: DateTime.new(2017))
796
- .create_webhook_execution
797
- .create_triggered_webhook(uuid: "638", created_at: DateTime.new(2018))
798
- .create_webhook_execution
799
- .create_consumer_webhook
800
- .create_triggered_webhook(uuid: "555", created_at: DateTime.new(2017))
801
- .create_webhook_execution
802
- .create_triggered_webhook(uuid: "777", created_at: DateTime.new(2018))
803
- .create_webhook_execution
804
- end
805
-
806
- subject { Repository.new.find_latest_triggered_webhooks_for_pact(td.pact) }
807
-
808
- it "finds the latest triggered webhooks" do
809
- expect(subject.collect(&:uuid).sort).to eq ["332", "638", "777"]
810
- end
811
- end
812
-
813
- describe "find_triggered_webhooks_for_pact" do
814
- before do
815
- td
816
- .create_pact_with_hierarchy("Foo", "1", "Bar")
817
- .create_webhook
818
- .create_triggered_webhook(uuid: "1")
819
- .create_webhook_execution
820
- .create_consumer_version("2")
821
- .create_pact
822
- .create_triggered_webhook(uuid: "2")
823
- .create_webhook_execution
824
- end
825
-
826
- subject { Repository.new.find_triggered_webhooks_for_pact(td.pact) }
827
-
828
- it "finds the triggered webhooks" do
829
- expect(subject.collect(&:uuid).sort).to eq ["2"]
830
- end
831
- end
832
-
833
- describe "find_triggered_webhooks_for_verification" do
834
- before do
835
- td
836
- .create_pact_with_hierarchy("Foo", "1", "Bar")
837
- .create_verification_webhook
838
- .create_verification(provider_version: "1")
839
- .create_triggered_webhook(uuid: "1")
840
- .create_verification(provider_version: "2", number: 2)
841
- .create_triggered_webhook(uuid: "2")
842
- end
843
-
844
- subject { Repository.new.find_triggered_webhooks_for_verification(td.verification) }
845
-
846
- it "finds the triggered webhooks" do
847
- expect(subject.collect(&:uuid).sort).to eq ["2"]
848
- end
849
- end
850
-
851
- describe "fail_retrying_triggered_webhooks" do
852
- before do
853
- td.create_pact_with_hierarchy
854
- .create_webhook
855
- .create_triggered_webhook(status: TriggeredWebhook::STATUS_RETRYING)
856
- .create_triggered_webhook(status: TriggeredWebhook::STATUS_SUCCESS)
857
- .create_triggered_webhook(status: TriggeredWebhook::STATUS_NOT_RUN)
858
- .create_triggered_webhook(status: TriggeredWebhook::STATUS_FAILURE)
859
- end
860
-
861
- it "sets the triggered_webhooks with retrying status to failed" do
862
- Repository.new.fail_retrying_triggered_webhooks
863
- expect(TriggeredWebhook.failed.count).to eq 2
864
- expect(TriggeredWebhook.retrying.count).to eq 0
865
- expect(TriggeredWebhook.successful.count).to eq 1
866
- expect(TriggeredWebhook.not_run.count).to eq 1
867
- end
868
- end
869
-
870
- describe "delete_triggered_webhooks_by_pact_publication_id" do
871
- before do
872
- td.create_pact_with_hierarchy
873
- .create_webhook
874
- .create_triggered_webhook
875
- .create_webhook_execution
876
- .create_pact_with_hierarchy("A Consumer", "1.2.3", "A Provider")
877
- .create_webhook
878
- .create_triggered_webhook
879
- .create_webhook_execution
880
- end
881
-
882
- subject { Repository.new.delete_triggered_webhooks_by_pact_publication_ids [td.pact.id] }
883
-
884
- it "deletes the triggered webhook" do
885
- expect { subject }.to change {
886
- TriggeredWebhook.count
887
- }.by(-1)
888
- end
889
-
890
- it "deletes the webhook_execution" do
891
- expect { subject }.to change {
892
- Execution.exclude(triggered_webhook_id: nil).count
893
- }.by(-1)
894
- end
895
- end
896
-
897
- describe "delete_triggered_webhooks_by_version_id" do
898
- subject { Repository.new.delete_triggered_webhooks_by_version_id(version.id) }
899
-
900
- context "when deleting a triggered webhook by consumer version" do
901
- let!(:version) do
902
- td
903
- .create_pact_with_hierarchy
904
- .create_webhook
905
- .create_triggered_webhook
906
- .create_webhook_execution
907
- .and_return(:consumer_version)
908
- end
909
-
910
- it "deletes the webhooks belonging to the consumer version" do
911
- expect { subject }.to change{ TriggeredWebhook.count }.by(-1)
912
- end
913
- end
914
-
915
- context "when deleting a triggered webhook by provider version" do
916
- let!(:version) do
917
- td
918
- .create_pact_with_hierarchy
919
- .create_verification(provider_version: "1")
920
- .create_provider_webhook(event_names: ["provider_verification_published"])
921
- .create_triggered_webhook
922
- .create_webhook_execution
923
- .and_return(:provider_version)
924
- end
925
-
926
- it "deletes the webhooks belonging to the consumer version" do
927
- expect { subject }.to change{ TriggeredWebhook.count }.by(-1)
928
- end
929
- end
930
- end
931
- end
932
- end
933
- end