From 29a54b61cb6d170645fbda7efe13148c3cae505d Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 25 Feb 2021 09:33:07 +1100 Subject: [PATCH] test: add matrix deployed version spec --- .../matrix_deployed_version_spec.rb | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 spec/lib/pact_broker/ui/view_models/matrix_deployed_version_spec.rb diff --git a/spec/lib/pact_broker/ui/view_models/matrix_deployed_version_spec.rb b/spec/lib/pact_broker/ui/view_models/matrix_deployed_version_spec.rb new file mode 100644 index 000000000..f2c1d7ddc --- /dev/null +++ b/spec/lib/pact_broker/ui/view_models/matrix_deployed_version_spec.rb @@ -0,0 +1,29 @@ +require 'pact_broker/ui/view_models/matrix_deployed_version' + +module PactBroker + module UI + module ViewDomain + describe MatrixDeployedVersion do + before do + allow(subject).to receive(:deployed_version_url).and_return("http://deployed_version") + allow(subject).to receive(:hal_browser_url) do | url | + "http://halbrowser#" + url + end + end + subject(:matrix_deployed_version) { MatrixDeployedVersion.new(deployed_version) } + let(:deployed_version) do + instance_double("PactBroker::Deployments::DeployedVersion", + environment: environment, + created_at: created_at + ) + end + let(:created_at) { (Date.today - 1).to_datetime } + let(:environment) { instance_double("PactBroker::Deployments::Environment", name: "test", display_name: "Test") } + + its(:environment_name) { is_expected.to eq "test" } + its(:tooltip) { is_expected.to eq "Currently deployed to Test (1 day ago)" } + its(:url) { is_expected.to eq "http://halbrowser#http://deployed_version" } + end + end + end +end