diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 12:09:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 12:09:46 +0300 |
commit | 221b529789f4090341a825695aeb49b8df6dd11d (patch) | |
tree | c8843e4ca5ef1034752eb68712fcf338b24950db /spec/lib/gitlab/static_site_editor | |
parent | 00a8c64ffd18e74df4b1cdeda7776b5221fddafe (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/static_site_editor')
-rw-r--r-- | spec/lib/gitlab/static_site_editor/config_spec.rb | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/spec/lib/gitlab/static_site_editor/config_spec.rb b/spec/lib/gitlab/static_site_editor/config_spec.rb index dea79fb0e92..8f61476722d 100644 --- a/spec/lib/gitlab/static_site_editor/config_spec.rb +++ b/spec/lib/gitlab/static_site_editor/config_spec.rb @@ -18,13 +18,44 @@ describe Gitlab::StaticSiteEditor::Config do it 'returns data for the frontend component' do is_expected.to eq( branch: 'master', - commit: repository.commit.id, + commit_id: repository.commit.id, namespace: 'namespace', path: 'README.md', project: 'project', project_id: project.id, - return_url: 'http://example.com' + return_url: 'http://example.com', + is_supported_content: true ) end + + context 'when branch is not master' do + let(:ref) { 'my-branch' } + + 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) } + end + + context 'when file does not have an extension' do + let(:file_path) { 'README' } + + 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) } + end + + context 'when repository is empty' do + let(:project) { create(:project_empty_repo) } + + it { is_expected.to include(is_supported_content: false) } + end end end |