2018-03-17 18:26:18 +05:30
|
|
|
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-05-09 12:01:36 +05:30
|
|
|
expect(Banzai::ObjectRenderer)
|
|
|
|
.to receive(:new)
|
|
|
|
.with(
|
|
|
|
user: user,
|
|
|
|
redaction_context: {
|
|
|
|
requested_path: 'foo',
|
|
|
|
project_wiki: wiki,
|
|
|
|
ref: 'bar',
|
|
|
|
only_path: nil,
|
|
|
|
xhtml: false
|
|
|
|
}
|
|
|
|
)
|
2018-03-17 18:26:18 +05:30
|
|
|
.and_call_original
|
|
|
|
|
|
|
|
expect_any_instance_of(Banzai::ObjectRenderer)
|
2018-05-09 12:01:36 +05:30
|
|
|
.to receive(:render)
|
|
|
|
.with([note], :note)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
described_class.new(user).execute([note],
|
2018-03-17 18:26:18 +05:30
|
|
|
requested_path: 'foo',
|
|
|
|
project_wiki: wiki,
|
|
|
|
ref: 'bar',
|
|
|
|
only_path: nil,
|
|
|
|
xhtml: false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|