pact_broker 2.52.1 → 2.52.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcde7335c14299ef14a5e21aa486ae302542bf439e78ed849ce7752f85b6dc9b
4
- data.tar.gz: 4746a31c5ced8803ab8657801e3ff1e07dadc57aaa4afeed4fe448de9d865255
3
+ metadata.gz: afd447b5cac167d4f764356d1c15c826a7de019d1871c684853ef602862cf387
4
+ data.tar.gz: '07328be4c8851d55e5a5834f69ce83e22df99c93cf83a21a657e1587f7afd8b3'
5
5
  SHA512:
6
- metadata.gz: 531d527b0b3772373874678f52eca8ad7a9f54954d05dfbf5852b51e5565e0654fd80bdca6b2a1c9510fc4442e6269447c71867854f1d70cd95b35eba1e7f521
7
- data.tar.gz: f5cd8971d2ad9b1b0e66edb54c19e6e2676a5dd624c5da07dfbe90ed3797d428eb024b34d4b37564ddcad8e28720d7322783eefa140ed6dabe84f74b4d9b3f44
6
+ metadata.gz: 9b8420208b660677ba8f93373346ad39e80069ba282dd9ebd7206bf65ebdf05f7803c303c1e6e0a4ebc7f69d3ff6ea2b55ecfe4e56a2735975827bad26e10370
7
+ data.tar.gz: fecbcc5f5a4824d2dc3669d6bb4bb15456ad1434031dad96e71bd571e9f92fd73d1b90b142f0d0359d6943ab618768ba607f99119fa61ffb56f75f6fb8e29ef3
@@ -1,3 +1,12 @@
1
+ <a name="v2.52.2"></a>
2
+ ### v2.52.2 (2020-04-16)
3
+
4
+
5
+ #### Bug Fixes
6
+
7
+ * pact URL in matrix page ([5ed046f1](/../../commit/5ed046f1))
8
+
9
+
1
10
  <a name="v2.52.1"></a>
2
11
  ### v2.52.1 (2020-03-30)
3
12
 
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at pact-support@googlegroups.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
@@ -19,7 +19,7 @@ Sequel.migration do
19
19
  end
20
20
 
21
21
  down do
22
- drop_view(:latest_version_orders)
23
22
  drop_view(:latest_versions)
23
+ drop_view(:latest_version_orders)
24
24
  end
25
25
  end
@@ -1,12 +1,13 @@
1
1
  require 'pact_broker/api/resources/base_resource'
2
2
  require 'pact_broker/api/decorators/pacticipant_decorator'
3
3
  require 'pact_broker/domain/pacticipant'
4
+ require 'pact_broker/hash_refinements'
4
5
 
5
6
  module PactBroker
6
7
  module Api
7
8
  module Resources
8
-
9
9
  class Pacticipants < BaseResource
10
+ using PactBroker::HashRefinements
10
11
 
11
12
  def content_types_provided
12
13
  [["application/hal+json", :to_json]]
@@ -32,7 +33,7 @@ module PactBroker
32
33
  end
33
34
 
34
35
  def from_json
35
- created_model = pacticipant_service.create(params)
36
+ created_model = pacticipant_service.create(params.symbolize_keys.snakecase_keys.slice(:name, :repository_url))
36
37
  response.body = decorator_for(created_model).to_json(user_options: decorator_context)
37
38
  end
38
39
 
@@ -22,6 +22,10 @@ module PactBroker
22
22
  snakecase_keys_private(self)
23
23
  end
24
24
 
25
+ def slice(*keys)
26
+ keys.each_with_object(Hash.new) { |k, hash| hash[k] = self[k] if has_key?(k) }
27
+ end
28
+
25
29
  private
26
30
 
27
31
  def snakecase_keys_private(params)
@@ -204,6 +204,7 @@ module PactBroker
204
204
  params.delete(:comment)
205
205
  json_content = params[:json_content] || default_json_content
206
206
  pact_version_sha = params[:pact_version_sha] || generate_pact_version_sha(json_content)
207
+ pact_versions_count_before = PactBroker::Pacts::PactVersion.count
207
208
  @pact = PactBroker::Pacts::Repository.new.create(
208
209
  version_id: @consumer_version.id,
209
210
  consumer_id: @consumer.id,
@@ -211,8 +212,9 @@ module PactBroker
211
212
  pact_version_sha: pact_version_sha,
212
213
  json_content: prepare_json_content(json_content),
213
214
  )
215
+ pact_versions_count_after = PactBroker::Pacts::PactVersion.count
214
216
  set_created_at_if_set(params[:created_at], :pact_publications, id: @pact.id)
215
- set_created_at_if_set(params[:created_at], :pact_versions, sha: @pact.pact_version_sha)
217
+ set_created_at_if_set(params[:created_at], :pact_versions, sha: @pact.pact_version_sha) if pact_versions_count_after > pact_versions_count_before
216
218
  set_created_at_if_set(params[:created_at], :latest_pact_publication_ids_for_consumer_versions, consumer_version_id: @consumer_version.id)
217
219
  @pact = PactBroker::Pacts::PactPublication.find(id: @pact.id).to_domain
218
220
  self
@@ -424,7 +426,10 @@ module PactBroker
424
426
  def set_created_at_if_set created_at, table_name, selector
425
427
  date_to_set = created_at || @now
426
428
  if date_to_set
427
- Sequel::Model.db[table_name].where(selector.keys.first => selector.values.first).update(created_at: date_to_set)
429
+ Sequel::Model.db[table_name].where(selector).update(created_at: date_to_set)
430
+ if Sequel::Model.db.schema(table_name).any?{ |col| col.first == :updated_at }
431
+ Sequel::Model.db[table_name].where(selector.keys.first => selector.values.first).update(updated_at: date_to_set)
432
+ end
428
433
  end
429
434
  end
430
435
 
@@ -150,7 +150,7 @@ module PactBroker
150
150
  end
151
151
 
152
152
  def pact_publication_date_url
153
- pact_url_from_params('', @line)
153
+ pact_url('', @line)
154
154
  end
155
155
 
156
156
  def relative_date date
@@ -1,3 +1,3 @@
1
1
  module PactBroker
2
- VERSION = '2.52.1'
2
+ VERSION = '2.52.2'
3
3
  end
@@ -0,0 +1,6 @@
1
+ describe "migrate and rollback", migration: true do
2
+ it "doesn't blow up" do
3
+ PactBroker::Database.migrate
4
+ PactBroker::Database.migrate(20190509) # previous migration uses an irreversible migration
5
+ end
6
+ end
@@ -244,4 +244,15 @@ Pact.provider_states_for "Pact Broker Client" do
244
244
  .create_webhook(uuid: "696c5f93-1b7f-44bc-8d03-59440fcaa9a0")
245
245
  end
246
246
  end
247
+
248
+ provider_state "the pacticipant relations are present" do
249
+ no_op
250
+ end
251
+
252
+ provider_state "a pacticipant with name Foo exists" do
253
+ set_up do
254
+ TestDataBuilder.new
255
+ .create_consumer("Foo")
256
+ end
257
+ end
247
258
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.52.1
4
+ version: 2.52.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Skurrie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-03-29 00:00:00.000000000 Z
13
+ date: 2020-04-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -624,6 +624,7 @@ files:
624
624
  - ".ruby-version"
625
625
  - ".travis.yml"
626
626
  - CHANGELOG.md
627
+ - CODE_OF_CONDUCT.md
627
628
  - CONTRIBUTING.md
628
629
  - DEVELOPER_DOCUMENTATION.md
629
630
  - DEVELOPER_SETUP.md
@@ -1540,6 +1541,7 @@ files:
1540
1541
  - spec/migrations/44_add_provider_version_to_verification_spec.rb
1541
1542
  - spec/migrations/50_create_latest_matrix_spec.rb
1542
1543
  - spec/migrations/change_migration_strategy_spec.rb
1544
+ - spec/migrations/rollback_spec.rb
1543
1545
  - spec/service_consumers/hal_relation_proxy_app.rb
1544
1546
  - spec/service_consumers/pact_helper.rb
1545
1547
  - spec/service_consumers/provider_states_for_pact_broker_client.rb
@@ -1639,8 +1641,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1639
1641
  - !ruby/object:Gem::Version
1640
1642
  version: '0'
1641
1643
  requirements: []
1642
- rubyforge_project:
1643
- rubygems_version: 2.7.6
1644
+ rubygems_version: 3.1.2
1644
1645
  signing_key:
1645
1646
  specification_version: 4
1646
1647
  summary: See description
@@ -1920,6 +1921,7 @@ test_files:
1920
1921
  - spec/migrations/44_add_provider_version_to_verification_spec.rb
1921
1922
  - spec/migrations/50_create_latest_matrix_spec.rb
1922
1923
  - spec/migrations/change_migration_strategy_spec.rb
1924
+ - spec/migrations/rollback_spec.rb
1923
1925
  - spec/service_consumers/hal_relation_proxy_app.rb
1924
1926
  - spec/service_consumers/pact_helper.rb
1925
1927
  - spec/service_consumers/provider_states_for_pact_broker_client.rb