2019-07-25 22:30:50 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe MergeRequestSidebarBasicEntity do
|
2019-07-25 22:30:50 -04:00
|
|
|
let(:project) { create :project, :repository }
|
|
|
|
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
let(:request) { double('request', current_user: user, project: project) }
|
|
|
|
|
|
|
|
let(:entity) { described_class.new(merge_request, request: request).as_json }
|
|
|
|
|
|
|
|
describe '#current_user' do
|
|
|
|
it 'contains attributes related to the current user' do
|
2020-05-12 08:09:47 -04:00
|
|
|
expect(entity[:current_user].keys).to include(
|
2019-07-25 22:30:50 -04:00
|
|
|
:id, :name, :username, :state, :avatar_url, :web_url, :todo,
|
|
|
|
:can_edit, :can_move, :can_admin_label, :can_merge
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|