2016-12-06 12:59:03 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ChatNotificationService, models: true 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-04-18 05:50:04 -04:00
|
|
|
subject.project = create(:empty_project, :empty_repo)
|
|
|
|
|
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
|
|
|
|
subject.project = create(:project)
|
|
|
|
|
|
|
|
expect(subject.can_test?).to be true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-12-06 12:59:03 -05:00
|
|
|
end
|