2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe ChatNotificationService do
|
2017-08-17 22:00:37 +05:30
|
|
|
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 true' do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject.project = create(:project, :empty_repo)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expect(subject.can_test?).to be true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with repository' do
|
|
|
|
it 'returns true' do
|
2017-09-10 17:25:29 +05:30
|
|
|
subject.project = create(:project, :repository)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expect(subject.can_test?).to be true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|