diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-05-31 16:03:32 +0300 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-05-31 16:03:32 +0300 |
commit | b888ed59abd3a6cc6a1c14278c38fda472f5b90c (patch) | |
tree | 41fe86ce3c76ada3379a2528c40313a027e22259 /spec/helpers | |
parent | 632d0c0a4c6ed8dd099f67a6914868811490e6a4 (diff) |
Fixed issuables_helper_spec and added a test for issuable_app_data
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/issuables_helper_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index e55e489b02f..b5dd0f21cbd 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -193,6 +193,32 @@ describe IssuablesHelper do end end + describe '#issuable_app_data' do + let(:user) { create(:user) } + let(:project) { create(:project) } + let(:issue) { create(:issue, project: project, last_edited_by: user, created_at: 3.days.ago, updated_at: 2.days.ago, last_edited_at: 2.days.ago) } + + let(:issue_app_data) do + { + endpoint: realtime_changes_namespace_project_issue_path(project.namespace, project, issue), + 'can-update' => "true", + 'issuable-ref' => issue.to_reference || '', + updated_at: issue.updated_at.to_time.iso8601, + updated_by: { + name: user.name, + path: user_path(user) + } + } + end + + before do + allow(helper).to receive(:current_user).and_return(nil) + allow(helper).to receive(:can?).with(nil, :update_issue, issue).and_return(true) + end + + it { expect(helper.issuable_app_data(issue.project, issue)).to eq(issue_app_data) } + end + describe '#updated_at_by' do let(:user) { create(:user) } let(:unedited_issuable) { create(:issue) } |