diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/blob_helper_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/helpers/blob_helper_spec.rb b/spec/helpers/blob_helper_spec.rb index 1fa194fe1b8..8de615ad8c2 100644 --- a/spec/helpers/blob_helper_spec.rb +++ b/spec/helpers/blob_helper_spec.rb @@ -242,4 +242,29 @@ describe BlobHelper do end end end + + describe '#ide_edit_path' do + let(:project) { create(:project) } + + around do |example| + old_script_name = Rails.application.routes.default_url_options[:script_name] + begin + example.run + ensure + Rails.application.routes.default_url_options[:script_name] = old_script_name + end + end + + it 'returns full IDE path' do + Rails.application.routes.default_url_options[:script_name] = nil + + expect(helper.ide_edit_path(project, "master", "")).to eq("/-/ide/project/#{project.namespace.path}/#{project.path}/edit/master/") + end + + it 'returns IDE path without relative_url_root' do + Rails.application.routes.default_url_options[:script_name] = "/gitlab" + + expect(helper.ide_edit_path(project, "master", "")).to eq("/gitlab/-/ide/project/#{project.namespace.path}/#{project.path}/edit/master/") + end + end end |