Welcome to mirror list, hosted at ThFree Co, Russian Federation.

render_service_spec.rb « notes « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ad69721d876fbef339cae85e6eb05ebda9270157 (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
# frozen_string_literal: true

require 'spec_helper'

describe Notes::RenderService 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