Commit 29530857 authored by Nathan Friend's avatar Nathan Friend

Merge branch '212558-follow-up-parse-boolean' into 'master'

Refactor to use parseBoolean

See merge request gitlab-org/gitlab!30076
parents fd46e26d 04529170
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import StaticSiteEditor from './components/static_site_editor.vue';
import createStore from './store';
const initStaticSiteEditor = el => {
const { projectId, path: sourcePath, returnUrl } = el.dataset;
const isSupportedContent = 'isSupportedContent' in el.dataset;
const { isSupportedContent, projectId, path: sourcePath, returnUrl } = el.dataset;
const store = createStore({
initialState: {
isSupportedContent,
isSupportedContent: parseBoolean(isSupportedContent),
projectId,
returnUrl,
sourcePath,
......
......@@ -22,7 +22,7 @@ module Gitlab
project: project.path,
namespace: project.namespace.path,
return_url: return_url,
is_supported_content: supported_content?
is_supported_content: supported_content?.to_s
}
end
......
......@@ -24,38 +24,38 @@ describe Gitlab::StaticSiteEditor::Config do
project: 'project',
project_id: project.id,
return_url: 'http://example.com',
is_supported_content: true
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) }
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) }
it { is_expected.to include(is_supported_content: false) }
it { is_expected.to include(is_supported_content: 'false') }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment