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