debian-mirror-gitlab/spec/models/hooks/project_hook_spec.rb

30 lines
768 B
Ruby
Raw Normal View History

2019-05-18 00:54:41 +05:30
# frozen_string_literal: true
2014-09-02 18:07:02 +05:30
require 'spec_helper'
2017-09-10 17:25:29 +05:30
describe ProjectHook do
describe 'associations' do
2016-06-02 11:05:42 +05:30
it { is_expected.to belong_to :project }
end
2017-09-10 17:25:29 +05:30
describe 'validations' do
it { is_expected.to validate_presence_of(:project) }
end
2014-09-02 18:07:02 +05:30
describe '.push_hooks' do
2016-09-13 17:45:13 +05:30
it 'returns hooks for push events only' do
2014-09-02 18:07:02 +05:30
hook = create(:project_hook, push_events: true)
2015-10-24 18:46:33 +05:30
create(:project_hook, push_events: false)
2017-09-10 17:25:29 +05:30
expect(described_class.push_hooks).to eq([hook])
2014-09-02 18:07:02 +05:30
end
end
describe '.tag_push_hooks' do
2016-09-13 17:45:13 +05:30
it 'returns hooks for tag push events only' do
2014-09-02 18:07:02 +05:30
hook = create(:project_hook, tag_push_events: true)
2015-10-24 18:46:33 +05:30
create(:project_hook, tag_push_events: false)
2017-09-10 17:25:29 +05:30
expect(described_class.tag_push_hooks).to eq([hook])
2014-09-02 18:07:02 +05:30
end
end
end