diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-08-09 14:30:07 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-08-09 14:30:07 +0300 |
commit | a85eed6446fa0b4b899a71cb9a3cb5e011a41c3a (patch) | |
tree | 474f584c1900bf156b9864af1e53e63abe0b23a6 /spec/factories/merge_requests.rb | |
parent | 029fb98b02f00e55243eaa781dc2849e94f16ae5 (diff) |
Fake out Repository#fetch_ref for merge request if
the project didn't have a repository setup. We don't
try to stub it if the repository was already there.
Diffstat (limited to 'spec/factories/merge_requests.rb')
-rw-r--r-- | spec/factories/merge_requests.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index 1bc530d06db..19bf7582747 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -68,6 +68,16 @@ FactoryGirl.define do merge_user author end + after(:build) do |merge_request| + target_project = merge_request.target_project + + # Fake `fetch_ref` if we don't have repository + # We have too many existing tests replying on this behaviour + unless target_project.repository_exists? + allow(target_project.repository).to receive(:fetch_ref) + end + end + factory :merged_merge_request, traits: [:merged] factory :closed_merge_request, traits: [:closed] factory :reopened_merge_request, traits: [:opened] |