Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/static_site_editor/config_spec.rb')
-rw-r--r--spec/lib/gitlab/static_site_editor/config_spec.rb33
1 files changed, 32 insertions, 1 deletions
diff --git a/spec/lib/gitlab/static_site_editor/config_spec.rb b/spec/lib/gitlab/static_site_editor/config_spec.rb
index 4cfda83b8f6..b60a6a9b006 100644
--- a/spec/lib/gitlab/static_site_editor/config_spec.rb
+++ b/spec/lib/gitlab/static_site_editor/config_spec.rb
@@ -2,11 +2,14 @@
require 'spec_helper'
-describe Gitlab::StaticSiteEditor::Config do
+RSpec.describe Gitlab::StaticSiteEditor::Config do
subject(:config) { described_class.new(repository, ref, file_path, return_url) }
let_it_be(:namespace) { create(:namespace, name: 'namespace') }
+ let_it_be(:root_group) { create(:group, name: 'group') }
+ let_it_be(:subgroup) { create(:group, name: 'subgroup', parent: root_group) }
let_it_be(:project) { create(:project, :public, :repository, name: 'project', namespace: namespace) }
+ let_it_be(:project_with_subgroup) { create(:project, :public, :repository, name: 'project', group: subgroup) }
let_it_be(:repository) { project.repository }
let(:ref) { 'master' }
@@ -30,6 +33,34 @@ describe Gitlab::StaticSiteEditor::Config do
)
end
+ context 'when namespace is a subgroup' do
+ let(:repository) { project_with_subgroup.repository }
+
+ it 'returns data for the frontend component' do
+ is_expected.to include(
+ namespace: 'group/subgroup',
+ project: 'project',
+ base_url: '/group/subgroup/project/-/sse/master%2FREADME.md'
+ )
+ end
+ end
+
+ context 'when file has .md.erb extension' do
+ let(:file_path) { 'README.md.erb' }
+
+ before do
+ repository.create_file(
+ project.creator,
+ file_path,
+ '',
+ message: 'message',
+ branch_name: 'master'
+ )
+ end
+
+ it { is_expected.to include(is_supported_content: 'true') }
+ end
+
context 'when file path is nested' do
let(:file_path) { 'lib/README.md' }