2019-04-11 08:17:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-11-06 11:52:56 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 11:08:50 -04:00
|
|
|
RSpec.describe Notes::RenderService do
|
2017-11-06 11:52:56 -05:00
|
|
|
describe '#execute' do
|
|
|
|
it 'renders a Note' do
|
|
|
|
note = double(:note)
|
|
|
|
wiki = double(:wiki)
|
|
|
|
user = double(:user)
|
|
|
|
|
2018-04-03 09:45:17 -04:00
|
|
|
expect(Banzai::ObjectRenderer)
|
|
|
|
.to receive(:new)
|
|
|
|
.with(
|
|
|
|
user: user,
|
|
|
|
redaction_context: {
|
|
|
|
requested_path: 'foo',
|
|
|
|
project_wiki: wiki,
|
|
|
|
ref: 'bar',
|
|
|
|
only_path: nil,
|
|
|
|
xhtml: false
|
|
|
|
}
|
|
|
|
)
|
2017-11-06 11:52:56 -05:00
|
|
|
.and_call_original
|
|
|
|
|
|
|
|
expect_any_instance_of(Banzai::ObjectRenderer)
|
2018-04-03 09:45:17 -04:00
|
|
|
.to receive(:render)
|
|
|
|
.with([note], :note)
|
2017-11-06 11:52:56 -05:00
|
|
|
|
2018-04-03 09:45:17 -04:00
|
|
|
described_class.new(user).execute([note],
|
2017-11-06 11:52:56 -05:00
|
|
|
requested_path: 'foo',
|
|
|
|
project_wiki: wiki,
|
|
|
|
ref: 'bar',
|
|
|
|
only_path: nil,
|
|
|
|
xhtml: false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|