2017-08-23 16:53:29 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Banzai::CommitRenderer do
|
2019-06-05 04:59:48 +00:00
|
|
|
describe '.render', :clean_gitlab_redis_cache do
|
2017-08-23 16:53:29 +00:00
|
|
|
it 'renders a commit description and title' do
|
2017-12-11 14:21:06 +00:00
|
|
|
user = build(:user)
|
2017-08-23 16:53:29 +00:00
|
|
|
project = create(:project, :repository)
|
|
|
|
|
2018-04-03 13:45:17 +00:00
|
|
|
expect(Banzai::ObjectRenderer)
|
|
|
|
.to receive(:new)
|
|
|
|
.with(user: user, default_project: project)
|
|
|
|
.and_call_original
|
2017-08-23 16:53:29 +00: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 04:59:48 +00:00
|
|
|
expect(Banzai::Renderer).to receive(:cacheless_render_field).with(project.commit, attr, { skip_project_check: false }).and_call_original
|
2017-08-23 16:53:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
described_class.render([project.commit], project, user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|