summaryrefslogtreecommitdiff
path: root/spec/services/system_notes/base_service_spec.rb
blob: 96788b05829ea36f85254fb925e000b07ce4fa58 (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
41
42
43
44
# frozen_string_literal: true

require 'spec_helper'

describe SystemNotes::BaseService do
  let(:noteable) { double }
  let(:project) { double }
  let(:author) { double }

  let(:base_service) { described_class.new(noteable: noteable, project: project, author: author) }

  describe '#noteable' do
    subject { base_service.noteable }

    it { is_expected.to eq(noteable) }

    it 'returns nil if no arguments are given' do
      instance = described_class.new
      expect(instance.noteable).to be_nil
    end
  end

  describe '#project' do
    subject { base_service.project }

    it { is_expected.to eq(project) }

    it 'returns nil if no arguments are given' do
      instance = described_class.new
      expect(instance.project).to be_nil
    end
  end

  describe '#author' do
    subject { base_service.author }

    it { is_expected.to eq(author) }

    it 'returns nil if no arguments are given' do
      instance = described_class.new
      expect(instance.author).to be_nil
    end
  end
end