Commit 076a36a4 authored by Robert May's avatar Robert May

Validate that the key contains the data

parent 46d1c976
......@@ -291,7 +291,7 @@ RSpec.describe CommitsHelper do
end
describe "#commit_partial_cache_key" do
subject { helper.commit_partial_cache_key(commit, ref: ref, merge_request: merge_request, request: request) }
subject(:cache_key) { helper.commit_partial_cache_key(commit, ref: ref, merge_request: merge_request, request: request) }
let(:commit) { create(:commit).present(current_user: user) }
let(:commit_status) { Gitlab::Ci::Status::Running.new(pipeline, user) }
......@@ -323,5 +323,12 @@ RSpec.describe CommitsHelper do
}
)
end
describe "final cache key output" do
subject { ActiveSupport::Cache.expand_cache_key(cache_key) }
it { is_expected.to include(commit.cache_key) }
it { is_expected.to include(pipeline.cache_key) }
end
end
end
# frozen_string_literal: true
require "spec_helper"
RSpec.describe Gitlab::Ci::Status::Core do
let(:subj) { double("subject", cache_key: "foo") }
subject(:status) do
described_class.new(subj, double("user"))
end
describe "#cache_key" do
it "uses the subject's cache key" do
expect(status.cache_key).to eq(subj.cache_key)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment