diff --git a/lib/pact_broker/api.rb b/lib/pact_broker/api.rb index 6b39a4d79..00fcdf08e 100644 --- a/lib/pact_broker/api.rb +++ b/lib/pact_broker/api.rb @@ -13,6 +13,7 @@ module PactBroker # Pacts add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'version', :consumer_version_number], Api::Resources::Pact, {resource_name: "pact_publication"} + add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'pact-version', :pact_version_sha], Api::Resources::PactVersion, {resource_name: "pact_publication"} add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'version', :consumer_version_number, 'previous-distinct'], Api::Resources::PreviousDistinctPactVersion, {resource_name: "previous_distinct_pact_version"} add ['pacts', 'provider', :provider_name, 'consumer', :consumer_name, 'version', :consumer_version_number, 'diff', 'previous-distinct'], Api::Resources::PactContentDiff, {resource_name: "previous_distinct_pact_version_diff"} diff --git a/lib/pact_broker/api/resources/pact_version.rb b/lib/pact_broker/api/resources/pact_version.rb new file mode 100644 index 000000000..216ae873e --- /dev/null +++ b/lib/pact_broker/api/resources/pact_version.rb @@ -0,0 +1,13 @@ +require 'pact_broker/api/resources/pact' + +module PactBroker + module Api + module Resources + class PactVersion < Pact + def allowed_methods + ["GET"] + end + end + end + end +end diff --git a/spec/features/get_pact_version.rb b/spec/features/get_pact_version.rb new file mode 100644 index 000000000..cef1ad6ba --- /dev/null +++ b/spec/features/get_pact_version.rb @@ -0,0 +1,13 @@ +describe "retrieving a pact" do + subject { get path; last_response } + + context "when differing case is used in the consumer and provider names" do + let(:td) { TestDataBuilder.new } + let(:pact) { td.create_pact_with_hierarchy("Foo", "1", "Bar").and_return(:pact) } + let!(:path) { "/pacts/provider/Bar/consumer/Foo/pact-version/#{pact.pact_version_sha}" } + + it "returns a 200 Success" do + expect(subject.status).to be 200 + end + end +end