Commit 047fbf58 authored by Rémy Coutable's avatar Rémy Coutable

Fix failing specs due to @exists variable in Repository

parent 00ae67d5
...@@ -112,5 +112,10 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps ...@@ -112,5 +112,10 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps
def forked_project def forked_project
@forked_project ||= Projects::ForkService.new(public_project, current_user).execute @forked_project ||= Projects::ForkService.new(public_project, current_user).execute
# The call to project.repository.after_import in RepositoryForkWorker does
# not reset the @exists variable of @fork_project.repository so we have to
# explicitely call this method to clear the @exists variable.
@forked_project.repository.after_import
@forked_project
end end
end end
...@@ -13,6 +13,11 @@ describe MergeRequests::RefreshService, services: true do ...@@ -13,6 +13,11 @@ describe MergeRequests::RefreshService, services: true do
@project = create(:project, namespace: group, approvals_before_merge: 1, reset_approvals_on_push: true) @project = create(:project, namespace: group, approvals_before_merge: 1, reset_approvals_on_push: true)
@fork_project = Projects::ForkService.new(@project, @user).execute @fork_project = Projects::ForkService.new(@project, @user).execute
# The call to project.repository.after_import in RepositoryForkWorker does
# not reset the @exists variable of @fork_project.repository so we have to
# explicitely call this method to clear the @exists variable.
@fork_project.repository.after_import
@merge_request = create(:merge_request, @merge_request = create(:merge_request,
source_project: @project, source_project: @project,
source_branch: 'master', source_branch: 'master',
......
...@@ -439,7 +439,14 @@ describe SystemNoteService, services: true do ...@@ -439,7 +439,14 @@ describe SystemNoteService, services: true do
context 'commit with cross-reference from fork' do context 'commit with cross-reference from fork' do
let(:author2) { create(:user) } let(:author2) { create(:user) }
let(:forked_project) { Projects::ForkService.new(project, author2).execute } let(:forked_project) do
fp = Projects::ForkService.new(project, author2).execute
# The call to project.repository.after_import in RepositoryForkWorker does
# not reset the @exists variable of @fork_project.repository so we have to
# explicitely call this method to clear the @exists variable.
fp.repository.after_import
fp
end
let(:commit2) { forked_project.commit } let(:commit2) { forked_project.commit }
before do before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment