diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/helpers/blob_helper_spec.rb | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/helpers/blob_helper_spec.rb')
-rw-r--r-- | spec/helpers/blob_helper_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/helpers/blob_helper_spec.rb b/spec/helpers/blob_helper_spec.rb index c48d609836d..efcb8125f68 100644 --- a/spec/helpers/blob_helper_spec.rb +++ b/spec/helpers/blob_helper_spec.rb @@ -92,6 +92,30 @@ RSpec.describe BlobHelper do end end + describe "#relative_raw_path" do + include FakeBlobHelpers + + let_it_be(:project) { create(:project) } + + before do + assign(:project, project) + end + + [ + %w[/file.md /-/raw/main/], + %w[/test/file.md /-/raw/main/test/], + %w[/another/test/file.md /-/raw/main/another/test/] + ].each do |file_path, expected_path| + it "pointing from '#{file_path}' to '#{expected_path}'" do + blob = fake_blob(path: file_path) + assign(:blob, blob) + assign(:id, "main#{blob.path}") + assign(:path, blob.path) + + expect(helper.parent_dir_raw_path).to eq "/#{project.full_path}#{expected_path}" + end + end + end context 'viewer related' do include FakeBlobHelpers |