summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-02-23 15:45:32 +0100
committerJan Provaznik <jprovaznik@gitlab.com>2018-02-26 10:10:21 +0100
commit22addf26732e15bd63112c21f03a7f20c5feabc9 (patch)
tree983a54b1f7238e66581ab390dd1126f69e7de3f7 /spec/helpers
parent7eaafea288cc43f7e314e44c6e46c87661cfd21d (diff)
downloadgitlab-ce-22addf26732e15bd63112c21f03a7f20c5feabc9.tar.gz
Don't convert issuable_initial_data into JSONjprovazn-issuable-data
Instead of converting hash into JSON inside issuable_initial_data method, return hash and convert to JSON later. This allows us to easily extend basic issuable data with resource specific values. For example for Epic these data should include also labels, so we can then do something like: issuable_initial_data(@epic).merge(labels: @epic.labels).to_json
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/issuables_helper_spec.rb32
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb
index 7fa665aecdc..2fecd1a3d27 100644
--- a/spec/helpers/issuables_helper_spec.rb
+++ b/spec/helpers/issuables_helper_spec.rb
@@ -173,23 +173,23 @@ describe IssuablesHelper do
@project = issue.project
expected_data = {
- 'endpoint' => "/#{@project.full_path}/issues/#{issue.iid}",
- 'updateEndpoint' => "/#{@project.full_path}/issues/#{issue.iid}.json",
- 'canUpdate' => true,
- 'canDestroy' => true,
- 'issuableRef' => "##{issue.iid}",
- 'markdownPreviewPath' => "/#{@project.full_path}/preview_markdown",
- 'markdownDocsPath' => '/help/user/markdown',
- 'issuableTemplates' => [],
- 'projectPath' => @project.path,
- 'projectNamespace' => @project.namespace.path,
- 'initialTitleHtml' => issue.title,
- 'initialTitleText' => issue.title,
- 'initialDescriptionHtml' => '<p dir="auto">issue text</p>',
- 'initialDescriptionText' => 'issue text',
- 'initialTaskStatus' => '0 of 0 tasks completed'
+ endpoint: "/#{@project.full_path}/issues/#{issue.iid}",
+ updateEndpoint: "/#{@project.full_path}/issues/#{issue.iid}.json",
+ canUpdate: true,
+ canDestroy: true,
+ issuableRef: "##{issue.iid}",
+ markdownPreviewPath: "/#{@project.full_path}/preview_markdown",
+ markdownDocsPath: '/help/user/markdown',
+ issuableTemplates: [],
+ projectPath: @project.path,
+ projectNamespace: @project.namespace.path,
+ initialTitleHtml: issue.title,
+ initialTitleText: issue.title,
+ initialDescriptionHtml: '<p dir="auto">issue text</p>',
+ initialDescriptionText: 'issue text',
+ initialTaskStatus: '0 of 0 tasks completed'
}
- expect(JSON.parse(helper.issuable_initial_data(issue))).to eq(expected_data)
+ expect(helper.issuable_initial_data(issue)).to eq(expected_data)
end
end