From b277f23a538ffbbf100719f4d7434a9e458d5b5e Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 2 Apr 2015 07:02:47 -0700 Subject: [PATCH] Improve regexp to prevent false positives If a filename happened to contain "db" and enough "rwx" characters before, then this test would previously fail. For example: ``` drwxr-xr-x gitlab-runner/gitlab-runner 0 2015-04-02 07:46 uploads/tmp/cassidy.stokes8477/gitlabhq/36d972fa55d6b44810fc6fd843473adb/ ``` Adding a space before the "db" match string tightens up the regexp and reduces the chance of unintended match. --- spec/tasks/gitlab/backup_rake_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/tasks/gitlab/backup_rake_spec.rb b/spec/tasks/gitlab/backup_rake_spec.rb index 3d5d21c2a13..199ff7e162b 100644 --- a/spec/tasks/gitlab/backup_rake_spec.rb +++ b/spec/tasks/gitlab/backup_rake_spec.rb @@ -87,7 +87,7 @@ describe 'gitlab:app namespace rake task' do expect(tar_contents).to match('db/') expect(tar_contents).to match('uploads/') expect(tar_contents).to match('repositories/') - expect(tar_contents).not_to match(/^.{4,9}[rwx].*(db|uploads|repositories)\/$/) + expect(tar_contents).not_to match(/^.{4,9}[rwx].* (db|uploads|repositories)\/$/) end it 'should delete temp directories' do