2017-11-06 11:52:56 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Notes::RenderService do
|
|
|
|
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
|