diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/lib/gitlab/static_site_editor | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/lib/gitlab/static_site_editor')
-rw-r--r-- | spec/lib/gitlab/static_site_editor/config_spec.rb | 33 |
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' } |