summaryrefslogtreecommitdiff
path: root/spec/models/project_services/chat_notification_service_spec.rb
blob: 592c90cda365b775a9fc238dc568dad86bc57c40 (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
require 'spec_helper'

describe ChatNotificationService, models: true do
  describe 'Associations' do
    before do
      allow(subject).to receive(:activated?).and_return(true)
    end

    it { is_expected.to validate_presence_of :webhook }
  end

  describe '#can_test?' do
    context 'with empty repository' do
      it 'returns false' do
        subject.project = create(:empty_project, :empty_repo)

        expect(subject.can_test?).to be false
      end
    end

    context 'with repository' do
      it 'returns true' do
        subject.project = create(:project)

        expect(subject.can_test?).to be true
      end
    end
  end
end