diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-05-01 16:58:19 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-05-01 16:58:19 +0000 |
commit | 3d318f3c92d2e6ff8d03c94015bacf44c2542fdd (patch) | |
tree | 0f97216ad7578291082d8899d1a32c26a705ade2 /spec/lib | |
parent | 45f3b0b779b828c8afe4fcb1d0749266416f6b9e (diff) | |
parent | 13de8aeec8cce390b07c0ab31d5336cb54123ec7 (diff) | |
download | gitlab-ce-3d318f3c92d2e6ff8d03c94015bacf44c2542fdd.tar.gz |
Merge branch 'fix/add-specs-for-request-profiler' into 'master'
Add specs for Gitlab::RequestProfiler
Closes #31513
See merge request !11005
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/request_profiler_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/lib/gitlab/request_profiler_spec.rb b/spec/lib/gitlab/request_profiler_spec.rb new file mode 100644 index 00000000000..ae9c06ebb7d --- /dev/null +++ b/spec/lib/gitlab/request_profiler_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe Gitlab::RequestProfiler, lib: true do + describe '.profile_token' do + it 'returns a token' do + expect(described_class.profile_token).to be_present + end + + it 'caches the token' do + expect(Rails.cache).to receive(:fetch).with('profile-token') + + described_class.profile_token + end + end + + describe '.remove_all_profiles' do + it 'removes Gitlab::RequestProfiler::PROFILES_DIR directory' do + dir = described_class::PROFILES_DIR + FileUtils.mkdir_p(dir) + + expect(Dir.exist?(dir)).to be true + + described_class.remove_all_profiles + expect(Dir.exist?(dir)).to be false + end + end +end |