2016-12-06 17:59:03 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 14:24:02 +00:00
|
|
|
describe ChatNotificationService do
|
2017-04-18 09:50:04 +00:00
|
|
|
describe 'Associations' do
|
2016-12-06 17:59:03 +00:00
|
|
|
before do
|
|
|
|
allow(subject).to receive(:activated?).and_return(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to validate_presence_of :webhook }
|
|
|
|
end
|
2017-04-18 09:50:04 +00:00
|
|
|
|
|
|
|
describe '#can_test?' do
|
|
|
|
context 'with empty repository' do
|
2017-04-24 15:23:51 +00:00
|
|
|
it 'returns true' do
|
2017-08-02 19:55:11 +00:00
|
|
|
subject.project = create(:project, :empty_repo)
|
2017-04-18 09:50:04 +00:00
|
|
|
|
2017-04-24 15:23:51 +00:00
|
|
|
expect(subject.can_test?).to be true
|
2017-04-18 09:50:04 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with repository' do
|
|
|
|
it 'returns true' do
|
2017-08-01 18:51:52 +00:00
|
|
|
subject.project = create(:project, :repository)
|
2017-04-18 09:50:04 +00:00
|
|
|
|
|
|
|
expect(subject.can_test?).to be true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-12-06 17:59:03 +00:00
|
|
|
end
|