Commit 0469b44a authored by Dave Pisek's avatar Dave Pisek

Add specs for commit_path_template

parent f313562f
......@@ -17,7 +17,7 @@ export default {
// search for all occurences of "$COMMIT_SHA" within the given template, eg.: "/base/project/path/-/commit/$COMMIT_SHA"
const allCommitShaPlaceHolders = /\$COMMIT_SHA/g;
// Replace it with the actual commit hash
// NOTE: This can be swapped to using `replaceAll` once it's more widely supported
// NOTE: This can be swapped to using `String.prototype.replaceAll` once it's more widely supported (https://caniuse.com/?search=replaceAll)
return this.commitPathTemplate.replace(allCommitShaPlaceHolders, this.value);
},
},
......
......@@ -321,4 +321,14 @@ RSpec.describe CommitsHelper do
it { is_expected.to include(pipeline.cache_key) }
end
end
describe "#commit_path_template" do
let(:project) { create(:project, :repository) }
it "returns the correct path" do
expect(helper.commit_path_template(project))
.to eq("/#{project.namespace.full_path}/#{project.name}/-/commit/$COMMIT_SHA")
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