summaryrefslogtreecommitdiff
path: root/spec/helpers/ci/pipeline_editor_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/ci/pipeline_editor_helper_spec.rb')
-rw-r--r--spec/helpers/ci/pipeline_editor_helper_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/helpers/ci/pipeline_editor_helper_spec.rb b/spec/helpers/ci/pipeline_editor_helper_spec.rb
index 7686983eb0f..a08517d0c57 100644
--- a/spec/helpers/ci/pipeline_editor_helper_spec.rb
+++ b/spec/helpers/ci/pipeline_editor_helper_spec.rb
@@ -20,4 +20,36 @@ RSpec.describe Ci::PipelineEditorHelper do
expect(subject).to be false
end
end
+
+ describe '#js_pipeline_editor_data' do
+ let(:project) { create(:project, :repository) }
+
+ before do
+ allow(helper)
+ .to receive(:namespace_project_new_merge_request_path)
+ .and_return('/mock/project/-/merge_requests/new')
+
+ allow(helper)
+ .to receive(:image_path)
+ .and_return('foo')
+ end
+
+ subject(:pipeline_editor_data) { helper.js_pipeline_editor_data(project) }
+
+ it 'returns pipeline editor data' do
+ expect(pipeline_editor_data).to eq({
+ "ci-config-path": project.ci_config_path_or_default,
+ "commit-sha" => project.commit.sha,
+ "default-branch" => project.default_branch,
+ "empty-state-illustration-path" => 'foo',
+ "initial-branch-name": nil,
+ "lint-help-page-path" => help_page_path('ci/lint', anchor: 'validate-basic-logic-and-syntax'),
+ "new-merge-request-path" => '/mock/project/-/merge_requests/new',
+ "project-path" => project.path,
+ "project-full-path" => project.full_path,
+ "project-namespace" => project.namespace.full_path,
+ "yml-help-page-path" => help_page_path('ci/yaml/README')
+ })
+ end
+ end
end