summaryrefslogtreecommitdiff
path: root/spec/tasks
diff options
context:
space:
mode:
authorHordur Freyr Yngvason <hfyngvason@gitlab.com>2019-07-30 13:52:28 +0000
committerJan Provaznik <jprovaznik@gitlab.com>2019-07-30 13:52:28 +0000
commit012fe3141e11f29b0a25985425dd7de96bf436c9 (patch)
tree04787a7f6ce5cf4f1d33fd93407350ef4cce6ca7 /spec/tasks
parent11f82c891ab82620982ef157d3a6783ee56a6997 (diff)
downloadgitlab-ce-012fe3141e11f29b0a25985425dd7de96bf436c9.tar.gz
Fix broken update_project_templates rake task
This rake task had been broken for a while. This fixes the breakages, adds a test to help avoid future breakages, and adds a few ergonomic improvements to the task itself.
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/update_templates_rake_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/update_templates_rake_spec.rb b/spec/tasks/gitlab/update_templates_rake_spec.rb
new file mode 100644
index 00000000000..7b17549b8c7
--- /dev/null
+++ b/spec/tasks/gitlab/update_templates_rake_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+require 'rake_helper'
+
+describe 'gitlab:update_project_templates rake task' do
+ let!(:tmpdir) { Dir.mktmpdir }
+
+ before do
+ Rake.application.rake_require 'tasks/gitlab/update_templates'
+ create(:admin)
+ allow(Gitlab::ProjectTemplate)
+ .to receive(:archive_directory)
+ .and_return(Pathname.new(tmpdir))
+ end
+
+ after do
+ FileUtils.rm_rf(tmpdir)
+ end
+
+ it 'updates valid project templates' do
+ expect { run_rake_task('gitlab:update_project_templates', ['rails']) }
+ .to change { Dir.entries(tmpdir) }
+ .by(['rails.tar.gz'])
+ end
+end