2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Banzai::CommitRenderer do
|
2019-09-04 21:01:54 +05:30
|
|
|
describe '.render', :clean_gitlab_redis_cache do
|
2018-03-17 18:26:18 +05:30
|
|
|
it 'renders a commit description and title' do
|
2018-03-27 19:54:05 +05:30
|
|
|
user = build(:user)
|
2018-03-17 18:26:18 +05:30
|
|
|
project = create(:project, :repository)
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
expect(Banzai::ObjectRenderer)
|
|
|
|
.to receive(:new)
|
|
|
|
.with(user: user, default_project: project)
|
|
|
|
.and_call_original
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
described_class::ATTRIBUTES.each do |attr|
|
|
|
|
expect_any_instance_of(Banzai::ObjectRenderer).to receive(:render).with([project.commit], attr).once.and_call_original
|
2019-09-04 21:01:54 +05:30
|
|
|
expect(Banzai::Renderer).to receive(:cacheless_render_field).with(project.commit, attr, { skip_project_check: false }).and_call_original
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
described_class.render([project.commit], project, user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|