summaryrefslogtreecommitdiff
path: root/spec/services/notes/render_service_spec.rb
blob: d633cdd04487ba430fb7cbbd256810707c937fdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Notes::RenderService, feature_category: :team_planning do
  describe '#execute' do
    it 'renders a Note' do
      note = double(:note)
      wiki = double(:wiki)
      user = double(:user)

      expect(Banzai::ObjectRenderer)
        .to receive(:new)
        .with(
          user: user,
          redaction_context: {
              requested_path: 'foo',
              project_wiki: wiki,
              ref: 'bar',
              only_path: nil,
              xhtml: false
          }
        )
        .and_call_original

      expect_any_instance_of(Banzai::ObjectRenderer)
        .to receive(:render)
        .with([note], :note)

      described_class.new(user).execute(
        [note],
        requested_path: 'foo',
        project_wiki: wiki,
        ref: 'bar',
        only_path: nil,
        xhtml: false
      )
    end
  end
end