From 818a0c2c07a04c198ea404cde1bafa5c0566141a Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 30 Jul 2020 14:39:28 +1000 Subject: [PATCH] feat: add timestamps to version resource --- lib/pact_broker/api/decorators/version_decorator.rb | 2 ++ spec/lib/pact_broker/api/decorators/version_decorator_spec.rb | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib/pact_broker/api/decorators/version_decorator.rb b/lib/pact_broker/api/decorators/version_decorator.rb index 389eef31e..ad08e229f 100644 --- a/lib/pact_broker/api/decorators/version_decorator.rb +++ b/lib/pact_broker/api/decorators/version_decorator.rb @@ -10,6 +10,8 @@ class VersionDecorator < BaseDecorator collection :tags, embedded: true, :extend => PactBroker::Api::Decorators::EmbeddedTagDecorator + include Timestamps + link :self do | options | { title: 'Version', diff --git a/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb b/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb index 4769b47c9..858824be6 100644 --- a/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb +++ b/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb @@ -51,6 +51,10 @@ module Decorators expect(subject[:_embedded][:tags].first[:name]).to eq "prod" end + it "includes the timestamps" do + expect(subject[:createdAt]).to_not be nil + end + it "includes a list of sorted pacts" do expect(subject[:_links][:'pb:pact-versions']).to be_instance_of(Array) expect(subject[:_links][:'pb:pact-versions'].first[:href]).to include ("1.2.3")