disables test settings on chat notification services when repository is empty
This commit is contained in:
parent
554d297493
commit
7696191e33
|
@ -22,7 +22,7 @@ class ChatNotificationService < Service
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_test?
|
def can_test?
|
||||||
valid?
|
super && valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.supported_events
|
def self.supported_events
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: Disable test settings on chat notification services when repository is empty
|
||||||
|
merge_request: 10759
|
||||||
|
author:
|
|
@ -1,11 +1,29 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe ChatNotificationService, models: true do
|
describe ChatNotificationService, models: true do
|
||||||
describe "Associations" do
|
describe 'Associations' do
|
||||||
before do
|
before do
|
||||||
allow(subject).to receive(:activated?).and_return(true)
|
allow(subject).to receive(:activated?).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to validate_presence_of :webhook }
|
it { is_expected.to validate_presence_of :webhook }
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue