2014-09-02 18:07:02 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
describe ProjectHook, models: true do
|
2016-06-02 11:05:42 +05:30
|
|
|
describe "Associations" do
|
|
|
|
it { is_expected.to belong_to :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)
|
2014-09-02 18:07:02 +05:30
|
|
|
expect(ProjectHook.push_hooks).to eq([hook])
|
|
|
|
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)
|
2014-09-02 18:07:02 +05:30
|
|
|
expect(ProjectHook.tag_push_hooks).to eq([hook])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|