pact_broker 1.8.1 → 1.9.0.rc1
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +1 -0
- data/db/migrations/01_create_pacticipant_table.rb +1 -1
- data/db/migrations/02_create_versions_table.rb +1 -1
- data/db/migrations/03_create_pacts_table.rb +1 -1
- data/db/migrations/04_create_tags_table.rb +1 -1
- data/db/migrations/12_create_webhooks_table.rb +2 -2
- data/db/migrations/15_create_pact_version_content.rb +1 -1
- data/lib/pact_broker/api/renderers/html_pact_renderer.rb +6 -1
- data/lib/pact_broker/configuration.rb +3 -1
- data/lib/pact_broker/pacts/all_pacts.rb +7 -6
- data/lib/pact_broker/pacts/service.rb +5 -0
- data/lib/pact_broker/repositories/helpers.rb +16 -0
- data/lib/pact_broker/repositories/pacticipant_repository.rb +4 -2
- data/lib/pact_broker/repositories/tag_repository.rb +7 -5
- data/lib/pact_broker/repositories/version_repository.rb +6 -4
- data/lib/pact_broker/version.rb +1 -1
- data/pact_broker.gemspec +1 -1
- data/spec/features/get_pact_spec.rb +66 -0
- data/spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb +6 -0
- data/spec/lib/pact_broker/repositories/pacticipant_repository_spec.rb +30 -0
- data/spec/lib/pact_broker/repositories/tag_repository_spec.rb +13 -1
- data/spec/lib/pact_broker/repositories/version_repository_spec.rb +13 -5
- metadata +8 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 208bc2c96b00747e6675cc9056e9f4c15436544e
|
|
4
|
+
data.tar.gz: 9cf1e32591790a46ffe91410fac6ade7bbdfe68b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d51e7194bb7e31f3b8433056d7ac5feaa130366075fb7681f692f174309feb35c08a42941b85cc875daa912857aa89dc2ba28ab51f09e459d35d4f6066322de
|
|
7
|
+
data.tar.gz: 5adcf997c3020a9b6b144ad025ef960e129b79a401efc8b5533f8d31974c6cb269368916dd82b717f5f964fb285183fb278f637d203cd3f0ec4e07c781019f77
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@ Do this to generate your change history
|
|
|
2
2
|
|
|
3
3
|
$ git log --pretty=format:' * %h - %s (%an, %ad)' vX.Y.Z..HEAD
|
|
4
4
|
|
|
5
|
+
#### 1.9.0.rc1 (2015-07-19)
|
|
6
|
+
|
|
7
|
+
* c855a2c - Support case insensitive resource names (Beth Skurrie, Sun Jul 19 17:28:55 2015 +1000)
|
|
8
|
+
* 7ea3e61 - Update pact_broker.gemspec (Beth Skurrie, Tue Jul 14 09:02:30 2015 +1000)
|
|
9
|
+
* f299cfd - Added logging for publishing and deleting pacts (Beth Skurrie, Wed Jul 8 16:00:58 2015 +1000)
|
|
10
|
+
* 67f0edb - Log error when contract cannot be parsed to a Pact (Beth Skurrie, Wed Jul 8 15:54:29 2015 +1000)
|
|
11
|
+
* 57caf63 - Double ensure that tables are created with UTF-8 encoding https://github.com/bethesque/pact_broker/issues/24 (Beth Skurrie, Fri Jul 3 15:46:46 2015 +1000)
|
|
12
|
+
|
|
5
13
|
#### 1.8.1 (2015-06-30)
|
|
6
14
|
|
|
7
15
|
* d0d466d - Avoid making a query for tags for each pact shown on the Pacts page (Beth Skurrie, Tue Jun 30 06:42:09 2015 +1000)
|
data/README.md
CHANGED
|
@@ -18,6 +18,7 @@ Features:
|
|
|
18
18
|
* Dynamically generated network diagrams.
|
|
19
19
|
* Enables a pact version to be tagged (ie. "prod") so a provider can verify itself against a fixed version of a pact to ensure backwards compatibility.
|
|
20
20
|
* Webhooks to trigger a provider build when a consumer publishes a change to a pact.
|
|
21
|
+
* Tracks changes between Pact versions so you can tell when a consumer has changed its expectations.
|
|
21
22
|
* [Docker Pact Broker][docker]
|
|
22
23
|
|
|
23
24
|
Travis CI Status: [](https://travis-ci.org/bethesque/pact_broker)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Sequel.migration do
|
|
2
2
|
change do
|
|
3
|
-
create_table(:webhooks) do
|
|
3
|
+
create_table(:webhooks, charset: 'utf8') do
|
|
4
4
|
primary_key :id
|
|
5
5
|
String :uuid, null: false, unique: true, unique_constraint_name: 'uq_webhook_uuid'
|
|
6
6
|
String :method, null: false
|
|
@@ -11,7 +11,7 @@ Sequel.migration do
|
|
|
11
11
|
foreign_key :provider_id, :pacticipants, null: false, foreign_key_constraint_name: 'fk_webhooks_provider'
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
create_table(:webhook_headers) do
|
|
14
|
+
create_table(:webhook_headers, charset: 'utf8') do
|
|
15
15
|
String :name, null: false
|
|
16
16
|
String :value
|
|
17
17
|
foreign_key :webhook_id, :webhooks, null: false, foreign_key_constraint_name: 'fk_webhookheaders_webhooks'
|
|
@@ -3,7 +3,7 @@ require_relative 'migration_helper'
|
|
|
3
3
|
|
|
4
4
|
Sequel.migration do
|
|
5
5
|
change do
|
|
6
|
-
create_table(:pact_version_contents) do
|
|
6
|
+
create_table(:pact_version_contents, charset: 'utf8') do
|
|
7
7
|
String :sha, primary_key: true, null: false, primary_key_constraint_name: 'pk_pact_version_contents'
|
|
8
8
|
String :content, type: PactBroker::MigrationHelper.large_text_type
|
|
9
9
|
DateTime :created_at, null: false
|
|
@@ -3,6 +3,7 @@ require 'pact/reification'
|
|
|
3
3
|
require 'redcarpet'
|
|
4
4
|
require 'pact/doc/markdown/consumer_contract_renderer'
|
|
5
5
|
require 'pact_broker/api/pact_broker_urls'
|
|
6
|
+
require 'pact_broker/logging'
|
|
6
7
|
|
|
7
8
|
module PactBroker
|
|
8
9
|
module Api
|
|
@@ -11,6 +12,8 @@ module PactBroker
|
|
|
11
12
|
|
|
12
13
|
class NotAPactError < StandardError; end
|
|
13
14
|
|
|
15
|
+
include PactBroker::Logging
|
|
16
|
+
|
|
14
17
|
def self.call pact
|
|
15
18
|
new(pact).call
|
|
16
19
|
end
|
|
@@ -84,7 +87,9 @@ module PactBroker
|
|
|
84
87
|
|
|
85
88
|
def consumer_contract
|
|
86
89
|
Pact::ConsumerContract.from_json(@json_content)
|
|
87
|
-
rescue
|
|
90
|
+
rescue => e
|
|
91
|
+
logger.warn "#{e.class} #{e.message} #{e.backtrace.join("\n")}"
|
|
92
|
+
logger.warn "Could not parse the following content to a Pact, showing raw content instead: #{@json_content}"
|
|
88
93
|
raise NotAPactError
|
|
89
94
|
end
|
|
90
95
|
|
|
@@ -8,6 +8,7 @@ module PactBroker
|
|
|
8
8
|
|
|
9
9
|
attr_accessor :log_dir, :database_connection, :auto_migrate_db, :use_hal_browser, :html_pact_renderer
|
|
10
10
|
attr_accessor :validate_database_connection_config, :enable_diagnostic_endpoints, :version_parser
|
|
11
|
+
attr_accessor :use_case_sensitive_resource_names
|
|
11
12
|
attr_writer :logger
|
|
12
13
|
|
|
13
14
|
def logger
|
|
@@ -20,9 +21,10 @@ module PactBroker
|
|
|
20
21
|
config.log_dir = File.expand_path("./log")
|
|
21
22
|
config.auto_migrate_db = true
|
|
22
23
|
config.use_hal_browser = true
|
|
23
|
-
config.html_pact_renderer = default_html_pact_render
|
|
24
24
|
config.validate_database_connection_config = true
|
|
25
25
|
config.enable_diagnostic_endpoints = true
|
|
26
|
+
config.use_case_sensitive_resource_names = true
|
|
27
|
+
config.html_pact_renderer = default_html_pact_render
|
|
26
28
|
config.version_parser = PactBroker::Versions::ParseSemanticVersion
|
|
27
29
|
config
|
|
28
30
|
end
|
|
@@ -2,13 +2,13 @@ require 'pact_broker/domain/tag'
|
|
|
2
2
|
require 'pact_broker/domain/pacticipant'
|
|
3
3
|
require 'pact_broker/domain/version'
|
|
4
4
|
require 'pact_broker/pacts/pact_version_content'
|
|
5
|
+
require 'pact_broker/repositories/helpers'
|
|
5
6
|
|
|
6
7
|
module PactBroker
|
|
7
8
|
module Pacts
|
|
8
9
|
|
|
9
10
|
class AllPacts < Sequel::Model(:all_pacts)
|
|
10
11
|
|
|
11
|
-
|
|
12
12
|
set_primary_key :id
|
|
13
13
|
associate(:one_to_many, :tags, :class => "PactBroker::Domain::Tag", :reciprocal => :version, :key => :version_id, :primary_key => :consumer_version_id)
|
|
14
14
|
associate(:many_to_one, :pact_version_content, :key => :pact_version_content_sha, :primary_key => :sha)
|
|
@@ -24,22 +24,23 @@ module PactBroker
|
|
|
24
24
|
# {table_alias: :lp}
|
|
25
25
|
# )
|
|
26
26
|
# end
|
|
27
|
+
include PactBroker::Repositories::Helpers
|
|
27
28
|
|
|
28
29
|
def consumer consumer_name
|
|
29
|
-
|
|
30
|
+
where(name_like(:consumer_name, consumer_name))
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
def provider provider_name
|
|
33
|
-
|
|
34
|
+
where(name_like(:provider_name, provider_name))
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
def tag tag_name
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
filter = name_like(Sequel.qualify(:tags, :name), tag_name)
|
|
39
|
+
join(:tags, {version_id: :consumer_version_id}).where(filter)
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def consumer_version_number number
|
|
42
|
-
|
|
43
|
+
where(name_like(:consumer_version_number, number))
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
def consumer_version_order_before order
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'pact_broker/repositories'
|
|
2
2
|
require 'pact_broker/services'
|
|
3
|
+
require 'pact_broker/logging'
|
|
3
4
|
|
|
4
5
|
module PactBroker
|
|
5
6
|
module Pacts
|
|
@@ -9,6 +10,7 @@ module PactBroker
|
|
|
9
10
|
|
|
10
11
|
extend PactBroker::Repositories
|
|
11
12
|
extend PactBroker::Services
|
|
13
|
+
include PactBroker::Logging
|
|
12
14
|
|
|
13
15
|
def find_latest_pact params
|
|
14
16
|
pact_repository.find_latest_pact(params[:consumer_name], params[:provider_name], params[:tag])
|
|
@@ -23,6 +25,7 @@ module PactBroker
|
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
def delete params
|
|
28
|
+
logger.info "Deleting pact version with params #{params}"
|
|
26
29
|
pact_repository.delete(params)
|
|
27
30
|
end
|
|
28
31
|
|
|
@@ -77,6 +80,7 @@ module PactBroker
|
|
|
77
80
|
private
|
|
78
81
|
|
|
79
82
|
def update_pact params, existing_pact
|
|
83
|
+
logger.info "Updating existing pact version with params #{params}"
|
|
80
84
|
updated_pact = pact_repository.update existing_pact.id, params
|
|
81
85
|
|
|
82
86
|
if existing_pact.json_content != updated_pact.json_content
|
|
@@ -87,6 +91,7 @@ module PactBroker
|
|
|
87
91
|
end
|
|
88
92
|
|
|
89
93
|
def create_pact params, version, provider
|
|
94
|
+
logger.info "Creating new pact version with params #{params}"
|
|
90
95
|
pact = pact_repository.create json_content: params[:json_content], version_id: version.id, provider_id: provider.id
|
|
91
96
|
trigger_webhooks pact
|
|
92
97
|
pact
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module PactBroker
|
|
2
|
+
module Repositories
|
|
3
|
+
module Helpers
|
|
4
|
+
|
|
5
|
+
extend self
|
|
6
|
+
|
|
7
|
+
def name_like column_name, value
|
|
8
|
+
Sequel.like(column_name, value, case_sensitivity_options)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def case_sensitivity_options
|
|
12
|
+
{case_insensitive: !PactBroker.configuration.use_case_sensitive_resource_names}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
require 'sequel'
|
|
2
2
|
require 'pact_broker/domain/pacticipant'
|
|
3
|
+
require 'pact_broker/repositories/helpers'
|
|
3
4
|
|
|
4
5
|
module PactBroker
|
|
5
6
|
module Repositories
|
|
6
7
|
class PacticipantRepository
|
|
7
8
|
|
|
9
|
+
include Helpers
|
|
10
|
+
|
|
8
11
|
def find_by_name name
|
|
9
|
-
PactBroker::Domain::Pacticipant.where(name
|
|
12
|
+
PactBroker::Domain::Pacticipant.where(name_like(:name, name)).single_record
|
|
10
13
|
end
|
|
11
14
|
|
|
12
15
|
def find_by_id id
|
|
@@ -36,7 +39,6 @@ module PactBroker
|
|
|
36
39
|
def find_latest_version name
|
|
37
40
|
|
|
38
41
|
end
|
|
39
|
-
|
|
40
42
|
end
|
|
41
43
|
end
|
|
42
44
|
end
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
require 'pact_broker/domain/tag'
|
|
2
|
+
require 'pact_broker/repositories/helpers'
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
module PactBroker
|
|
4
6
|
module Repositories
|
|
5
7
|
class TagRepository
|
|
6
8
|
|
|
9
|
+
include Helpers
|
|
7
10
|
|
|
8
11
|
def create args
|
|
9
12
|
Domain::Tag.new(name: args.fetch(:name), version: args.fetch(:version)).save
|
|
@@ -14,12 +17,11 @@ module PactBroker
|
|
|
14
17
|
.select(:tags__name, :tags__version_id, :tags__created_at, :tags__updated_at)
|
|
15
18
|
.join(:versions, {id: :version_id})
|
|
16
19
|
.join(:pacticipants, {pacticipants__id: :versions__pacticipant_id})
|
|
17
|
-
.where(:tags__name
|
|
18
|
-
.where(:versions__number
|
|
19
|
-
.where(:pacticipants__name
|
|
20
|
+
.where(name_like(:tags__name, args.fetch(:tag_name)))
|
|
21
|
+
.where(name_like(:versions__number, args.fetch(:pacticipant_version_number)))
|
|
22
|
+
.where(name_like(:pacticipants__name, args.fetch(:pacticipant_name)))
|
|
20
23
|
.single_record
|
|
21
24
|
end
|
|
22
|
-
|
|
23
25
|
end
|
|
24
26
|
end
|
|
25
|
-
end
|
|
27
|
+
end
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
require 'sequel'
|
|
2
2
|
require 'pact_broker/domain/version'
|
|
3
|
+
require 'pact_broker/repositories/tag_repository'
|
|
3
4
|
|
|
4
5
|
module PactBroker
|
|
5
6
|
module Repositories
|
|
6
7
|
class VersionRepository
|
|
7
8
|
|
|
9
|
+
include Helpers
|
|
10
|
+
|
|
8
11
|
def find_by_pacticipant_id_and_number pacticipant_id, number
|
|
9
12
|
PactBroker::Domain::Version.where(number: number, pacticipant_id: pacticipant_id).single_record
|
|
10
13
|
end
|
|
@@ -12,9 +15,9 @@ module PactBroker
|
|
|
12
15
|
def find_by_pacticipant_name_and_number pacticipant_name, number
|
|
13
16
|
PactBroker::Domain::Version
|
|
14
17
|
.select(:versions__id, :versions__number, :versions__pacticipant_id, :versions__order, :versions__created_at, :versions__updated_at)
|
|
15
|
-
.where(number: number)
|
|
16
18
|
.join(:pacticipants, {id: :pacticipant_id})
|
|
17
|
-
.where(
|
|
19
|
+
.where(name_like(:number, number))
|
|
20
|
+
.where(name_like(:name, pacticipant_name))
|
|
18
21
|
.single_record
|
|
19
22
|
end
|
|
20
23
|
|
|
@@ -31,7 +34,6 @@ module PactBroker
|
|
|
31
34
|
create(pacticipant_id: pacticipant_id, number: number)
|
|
32
35
|
end
|
|
33
36
|
end
|
|
34
|
-
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
|
-
end
|
|
39
|
+
end
|
data/lib/pact_broker/version.rb
CHANGED
data/pact_broker.gemspec
CHANGED
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
|
|
|
11
11
|
gem.email = ["bskurrie@dius.com.au", "serge.matheson@rea-group.com", "warner@warnergodfrey.com"]
|
|
12
12
|
gem.description = %q{A server that stores and returns pact files generated by the pact gem. It enables head/prod cross testing of the consumer and provider projects.}
|
|
13
13
|
gem.summary = %q{See description}
|
|
14
|
-
gem.homepage = "https://github.com/
|
|
14
|
+
gem.homepage = "https://github.com/bethesque/pact_broker"
|
|
15
15
|
|
|
16
16
|
gem.files = `git ls-files`.split($/)
|
|
17
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
describe "retrieving a pact" do
|
|
2
|
+
|
|
3
|
+
subject { get path; last_response }
|
|
4
|
+
|
|
5
|
+
context "when differing case is used in the consumer and provider names" do
|
|
6
|
+
|
|
7
|
+
let(:path) { "/pacts/provider/a%20provider/consumer/a%20consumer/version/1.2.3A" }
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
ProviderStateBuilder.new.create_pact_with_hierarchy "A Consumer", "1.2.3a", "A Provider"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
context "when case sensitivity is turned on" do
|
|
14
|
+
before do
|
|
15
|
+
allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(true)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "returns a 404 Not found" do
|
|
19
|
+
expect(subject.status).to be 404
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context "when case sensitivity is turned off" do
|
|
24
|
+
before do
|
|
25
|
+
allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(false)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "returns a 200 Success" do
|
|
29
|
+
expect(subject.status).to be 200
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
context "when differing case is used in the tag name" do
|
|
34
|
+
|
|
35
|
+
let(:path) { "/pacts/provider/a%20provider/consumer/a%20consumer/latest/PROD" }
|
|
36
|
+
|
|
37
|
+
before do
|
|
38
|
+
ProviderStateBuilder.new
|
|
39
|
+
.create_consumer("A Consumer")
|
|
40
|
+
.create_consumer_version("1.2.3")
|
|
41
|
+
.create_consumer_version_tag("prod")
|
|
42
|
+
.create_provider("A Provider")
|
|
43
|
+
.create_pact
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
context "when case sensitivity is turned on" do
|
|
47
|
+
before do
|
|
48
|
+
allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(true)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "returns a 404 Not found" do
|
|
52
|
+
expect(subject.status).to be 404
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
context "when case sensitivity is turned off" do
|
|
57
|
+
before do
|
|
58
|
+
allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(false)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "returns a 200 Success" do
|
|
62
|
+
expect(subject.status).to be 200
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -60,6 +60,12 @@ module PactBroker
|
|
|
60
60
|
it "renders the JSON in HTML" do
|
|
61
61
|
expect(subject).to match /\[\s+1\s+\]/m
|
|
62
62
|
end
|
|
63
|
+
|
|
64
|
+
it "logs a warning" do
|
|
65
|
+
allow(PactBroker.logger).to receive(:warn).with(/Error/)
|
|
66
|
+
expect(PactBroker.logger).to receive(:warn).with(/Could not parse/)
|
|
67
|
+
subject
|
|
68
|
+
end
|
|
63
69
|
end
|
|
64
70
|
end
|
|
65
71
|
|
|
@@ -6,6 +6,36 @@ module PactBroker
|
|
|
6
6
|
module Repositories
|
|
7
7
|
describe PacticipantRepository do
|
|
8
8
|
|
|
9
|
+
describe "#find_by_name" do
|
|
10
|
+
before do
|
|
11
|
+
ProviderStateBuilder.new.create_pacticipant("Foo Bar")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
subject { PacticipantRepository.new.find_by_name('foo bar') }
|
|
15
|
+
|
|
16
|
+
context "when the name is a different case" do
|
|
17
|
+
context "with case sensitivity turned on" do
|
|
18
|
+
before do
|
|
19
|
+
allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(true)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "returns nil" do
|
|
23
|
+
expect(subject).to be nil
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context "with case sensitivity turned off" do
|
|
28
|
+
before do
|
|
29
|
+
allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(false)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "returns the pacticipant" do
|
|
33
|
+
expect(subject).to_not be nil
|
|
34
|
+
expect(subject.name).to eq "Foo Bar"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
9
39
|
|
|
10
40
|
describe "#pacticipant_names" do
|
|
11
41
|
|
|
@@ -8,7 +8,7 @@ module PactBroker
|
|
|
8
8
|
describe ".find" do
|
|
9
9
|
|
|
10
10
|
let(:pacticipant_name) { "test_pacticipant" }
|
|
11
|
-
let(:version_number) { "1.2.
|
|
11
|
+
let(:version_number) { "1.2.3a" }
|
|
12
12
|
let(:tag_name) { "prod" }
|
|
13
13
|
|
|
14
14
|
subject { TagRepository.new }
|
|
@@ -41,6 +41,18 @@ module PactBroker
|
|
|
41
41
|
expect(find_tag.updated_at).to be_instance_of(DateTime)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
+
context "when case sensitivity is turned off and a name with different case is used" do
|
|
45
|
+
before do
|
|
46
|
+
allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(false)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
let(:options) { {pacticipant_name: pacticipant_name.upcase, pacticipant_version_number: version_number.upcase, tag_name: tag_name.upcase} }
|
|
50
|
+
|
|
51
|
+
it "returns the tag" do
|
|
52
|
+
expect(find_tag).to_not be nil
|
|
53
|
+
expect(find_tag.name).to eq tag_name
|
|
54
|
+
end
|
|
55
|
+
end
|
|
44
56
|
end
|
|
45
57
|
|
|
46
58
|
context "when the tag does not exist" do
|
|
@@ -26,7 +26,6 @@ module PactBroker
|
|
|
26
26
|
|
|
27
27
|
describe "#find_by_pacticipant_name_and_number" do
|
|
28
28
|
|
|
29
|
-
|
|
30
29
|
subject { described_class.new.find_by_pacticipant_name_and_number pacticipant_name, version_number }
|
|
31
30
|
|
|
32
31
|
context "when the version exists" do
|
|
@@ -48,6 +47,18 @@ module PactBroker
|
|
|
48
47
|
expect(subject.tags.first.name).to eq "prod"
|
|
49
48
|
expect(subject.order).to eq 0
|
|
50
49
|
end
|
|
50
|
+
|
|
51
|
+
context "when case sensitivity is turned off and names with different cases are used" do
|
|
52
|
+
before do
|
|
53
|
+
allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(false)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
subject { described_class.new.find_by_pacticipant_name_and_number pacticipant_name.upcase, version_number.upcase }
|
|
57
|
+
|
|
58
|
+
it "returns the version" do
|
|
59
|
+
expect(subject).to_not be nil
|
|
60
|
+
end
|
|
61
|
+
end
|
|
51
62
|
end
|
|
52
63
|
|
|
53
64
|
context "when the version doesn't exist" do
|
|
@@ -55,10 +66,7 @@ module PactBroker
|
|
|
55
66
|
expect(subject).to be_nil
|
|
56
67
|
end
|
|
57
68
|
end
|
|
58
|
-
|
|
59
69
|
end
|
|
60
|
-
|
|
61
|
-
|
|
62
70
|
end
|
|
63
71
|
end
|
|
64
|
-
end
|
|
72
|
+
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: 1.
|
|
4
|
+
version: 1.9.0.rc1
|
|
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: 2015-
|
|
13
|
+
date: 2015-07-19 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: httparty
|
|
@@ -502,6 +502,7 @@ files:
|
|
|
502
502
|
- lib/pact_broker/project_root.rb
|
|
503
503
|
- lib/pact_broker/relationships/groupify.rb
|
|
504
504
|
- lib/pact_broker/repositories.rb
|
|
505
|
+
- lib/pact_broker/repositories/helpers.rb
|
|
505
506
|
- lib/pact_broker/repositories/pacticipant_repository.rb
|
|
506
507
|
- lib/pact_broker/repositories/tag_repository.rb
|
|
507
508
|
- lib/pact_broker/repositories/version_repository.rb
|
|
@@ -567,6 +568,7 @@ files:
|
|
|
567
568
|
- spec/features/create_webhook_spec.rb
|
|
568
569
|
- spec/features/delete_pact_spec.rb
|
|
569
570
|
- spec/features/get_diff.rb
|
|
571
|
+
- spec/features/get_pact_spec.rb
|
|
570
572
|
- spec/features/get_previous_distinct_version.rb
|
|
571
573
|
- spec/features/get_provider_pacts.rb
|
|
572
574
|
- spec/features/get_version.rb
|
|
@@ -691,7 +693,7 @@ files:
|
|
|
691
693
|
- vendor/hal-browser/vendor/js/jquery-1.10.2.min.map
|
|
692
694
|
- vendor/hal-browser/vendor/js/underscore.js
|
|
693
695
|
- vendor/hal-browser/vendor/js/uritemplates.js
|
|
694
|
-
homepage: https://github.com/
|
|
696
|
+
homepage: https://github.com/bethesque/pact_broker
|
|
695
697
|
licenses:
|
|
696
698
|
- MIT
|
|
697
699
|
metadata: {}
|
|
@@ -706,9 +708,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
706
708
|
version: '0'
|
|
707
709
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
708
710
|
requirements:
|
|
709
|
-
- - '
|
|
711
|
+
- - '>'
|
|
710
712
|
- !ruby/object:Gem::Version
|
|
711
|
-
version:
|
|
713
|
+
version: 1.3.1
|
|
712
714
|
requirements: []
|
|
713
715
|
rubyforge_project:
|
|
714
716
|
rubygems_version: 2.0.14
|
|
@@ -719,6 +721,7 @@ test_files:
|
|
|
719
721
|
- spec/features/create_webhook_spec.rb
|
|
720
722
|
- spec/features/delete_pact_spec.rb
|
|
721
723
|
- spec/features/get_diff.rb
|
|
724
|
+
- spec/features/get_pact_spec.rb
|
|
722
725
|
- spec/features/get_previous_distinct_version.rb
|
|
723
726
|
- spec/features/get_provider_pacts.rb
|
|
724
727
|
- spec/features/get_version.rb
|