summaryrefslogtreecommitdiff
path: root/spec/services/projects/import_service_spec.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-04-04 19:35:39 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-04-04 19:35:39 -0300
commitf2005fa56682a5dc3b57d610cb733a34b2e08520 (patch)
tree151024fc9a4ed60da9f28cc616b4f6fbc6ba1baa /spec/services/projects/import_service_spec.rb
parenta55fc41657567fc0343fe5cd6fee8c5e20c851ce (diff)
downloadgitlab-ce-f2005fa56682a5dc3b57d610cb733a34b2e08520.tar.gz
Flush repository cache before import project datafix-gh-pr-import
GitHub Pull Requests importer handle with the repository while importing data, we need to make sure that the cached values are valid.
Diffstat (limited to 'spec/services/projects/import_service_spec.rb')
-rw-r--r--spec/services/projects/import_service_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/services/projects/import_service_spec.rb b/spec/services/projects/import_service_spec.rb
index 04f474c736c..32bf3acf483 100644
--- a/spec/services/projects/import_service_spec.rb
+++ b/spec/services/projects/import_service_spec.rb
@@ -72,6 +72,23 @@ describe Projects::ImportService, services: true do
expect(result[:status]).to eq :success
end
+ it 'flushes various caches' do
+ expect_any_instance_of(Gitlab::Shell).to receive(:import_repository).
+ with(project.path_with_namespace, project.import_url).
+ and_return(true)
+
+ expect_any_instance_of(Gitlab::GithubImport::Importer).to receive(:execute).
+ and_return(true)
+
+ expect_any_instance_of(Repository).to receive(:expire_emptiness_caches).
+ and_call_original
+
+ expect_any_instance_of(Repository).to receive(:expire_exists_cache).
+ and_call_original
+
+ subject.execute
+ end
+
it 'fails if importer fails' do
expect_any_instance_of(Gitlab::Shell).to receive(:import_repository).with(project.path_with_namespace, project.import_url).and_return(true)
expect_any_instance_of(Gitlab::GithubImport::Importer).to receive(:execute).and_return(false)