Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/hooks/project_hook_spec.rb')
-rw-r--r--spec/models/hooks/project_hook_spec.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/spec/models/hooks/project_hook_spec.rb b/spec/models/hooks/project_hook_spec.rb
index 923a6f92424..3d8c377ab21 100644
--- a/spec/models/hooks/project_hook_spec.rb
+++ b/spec/models/hooks/project_hook_spec.rb
@@ -12,14 +12,14 @@ RSpec.describe ProjectHook do
end
it_behaves_like 'includes Limitable concern' do
- subject { build(:project_hook, project: create(:project)) }
+ subject { build(:project_hook) }
end
describe '.for_projects' do
it 'finds related project hooks' do
- hook_a = create(:project_hook)
- hook_b = create(:project_hook)
- hook_c = create(:project_hook)
+ hook_a = create(:project_hook, project: build(:project))
+ hook_b = create(:project_hook, project: build(:project))
+ hook_c = create(:project_hook, project: build(:project))
expect(described_class.for_projects([hook_a.project, hook_b.project]))
.to contain_exactly(hook_a, hook_b)
@@ -30,16 +30,18 @@ RSpec.describe ProjectHook do
describe '.push_hooks' do
it 'returns hooks for push events only' do
- hook = create(:project_hook, push_events: true)
- create(:project_hook, push_events: false)
+ project = build(:project)
+ hook = create(:project_hook, project: project, push_events: true)
+ create(:project_hook, project: project, push_events: false)
expect(described_class.push_hooks).to eq([hook])
end
end
describe '.tag_push_hooks' do
it 'returns hooks for tag push events only' do
- hook = create(:project_hook, tag_push_events: true)
- create(:project_hook, tag_push_events: false)
+ project = build(:project)
+ hook = create(:project_hook, project: project, tag_push_events: true)
+ create(:project_hook, project: project, tag_push_events: false)
expect(described_class.tag_push_hooks).to eq([hook])
end
end
@@ -65,7 +67,7 @@ RSpec.describe ProjectHook do
end
describe '#update_last_failure', :clean_gitlab_redis_shared_state do
- let_it_be(:hook) { create(:project_hook) }
+ let(:hook) { build(:project_hook) }
it 'is a method of this class' do
expect { hook.update_last_failure }.not_to raise_error