diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/lib/gitlab/static_site_editor | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/lib/gitlab/static_site_editor')
-rw-r--r-- | spec/lib/gitlab/static_site_editor/config_spec.rb | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/spec/lib/gitlab/static_site_editor/config_spec.rb b/spec/lib/gitlab/static_site_editor/config_spec.rb index 8f61476722d..a1db567db1a 100644 --- a/spec/lib/gitlab/static_site_editor/config_spec.rb +++ b/spec/lib/gitlab/static_site_editor/config_spec.rb @@ -5,9 +5,10 @@ require 'spec_helper' describe Gitlab::StaticSiteEditor::Config do subject(:config) { described_class.new(repository, ref, file_path, return_url) } - let(:project) { create(:project, :public, :repository, name: 'project', namespace: namespace) } - let(:namespace) { create(:namespace, name: 'namespace') } - let(:repository) { project.repository } + let_it_be(:namespace) { create(:namespace, name: 'namespace') } + let_it_be(:project) { create(:project, :public, :repository, name: 'project', namespace: namespace) } + let_it_be(:repository) { project.repository } + let(:ref) { 'master' } let(:file_path) { 'README.md' } let(:return_url) { 'http://example.com' } @@ -24,38 +25,45 @@ describe Gitlab::StaticSiteEditor::Config do project: 'project', project_id: project.id, return_url: 'http://example.com', - is_supported_content: true + is_supported_content: 'true', + base_url: '/namespace/project/-/sse/master%2FREADME.md' ) end + context 'when file path is nested' do + let(:file_path) { 'lib/README.md' } + + it { is_expected.to include(base_url: '/namespace/project/-/sse/master%2Flib%2FREADME.md') } + end + context 'when branch is not master' do let(:ref) { 'my-branch' } - it { is_expected.to include(is_supported_content: false) } + it { is_expected.to include(is_supported_content: 'false') } end context 'when file does not have a markdown extension' do let(:file_path) { 'README.txt' } - it { is_expected.to include(is_supported_content: false) } + it { is_expected.to include(is_supported_content: 'false') } end context 'when file does not have an extension' do let(:file_path) { 'README' } - it { is_expected.to include(is_supported_content: false) } + it { is_expected.to include(is_supported_content: 'false') } end context 'when file does not exist' do let(:file_path) { 'UNKNOWN.md' } - it { is_expected.to include(is_supported_content: false) } + it { is_expected.to include(is_supported_content: 'false') } end context 'when repository is empty' do - let(:project) { create(:project_empty_repo) } + let(:repository) { create(:project_empty_repo).repository } - it { is_expected.to include(is_supported_content: false) } + it { is_expected.to include(is_supported_content: 'false') } end end end |