diff options
Diffstat (limited to 'spec/helpers/issuables_helper_spec.rb')
-rw-r--r-- | spec/helpers/issuables_helper_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index 583b8f90db9..2f67ea457a0 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -243,4 +243,32 @@ describe IssuablesHelper do end end end + + describe '#assignee_sidebar_data' do + let(:user) { create(:user) } + let(:merge_request) { nil } + subject { helper.assignee_sidebar_data(user, merge_request: merge_request) } + + it 'returns hash of assignee data' do + is_expected.to eql({ + avatar_url: user.avatar_url, + name: user.name, + username: user.username + }) + end + + context 'with merge_request' do + let(:merge_request) { build_stubbed(:merge_request) } + + where(can_merge: [true, false]) + + with_them do + before do + allow(merge_request).to receive(:can_be_merged_by?).and_return(can_merge) + end + + it { is_expected.to include({ can_merge: can_merge })} + end + end + end end |