2019-07-25 01:21:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-23 12:53:29 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 05:08:32 -04:00
|
|
|
RSpec.describe Banzai::CommitRenderer do
|
2019-06-05 00:59:48 -04:00
|
|
|
describe '.render', :clean_gitlab_redis_cache do
|
2017-08-23 12:53:29 -04:00
|
|
|
it 'renders a commit description and title' do
|
2017-12-11 09:21:06 -05:00
|
|
|
user = build(:user)
|
2017-08-23 12:53:29 -04:00
|
|
|
project = create(:project, :repository)
|
|
|
|
|
2018-04-03 09:45:17 -04:00
|
|
|
expect(Banzai::ObjectRenderer)
|
|
|
|
.to receive(:new)
|
|
|
|
.with(user: user, default_project: project)
|
|
|
|
.and_call_original
|
2017-08-23 12:53:29 -04:00
|
|
|
|
|
|
|
described_class::ATTRIBUTES.each do |attr|
|
|
|
|
expect_any_instance_of(Banzai::ObjectRenderer).to receive(:render).with([project.commit], attr).once.and_call_original
|
2019-06-05 00:59:48 -04:00
|
|
|
expect(Banzai::Renderer).to receive(:cacheless_render_field).with(project.commit, attr, { skip_project_check: false }).and_call_original
|
2017-08-23 12:53:29 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
described_class.render([project.commit], project, user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|