2017-04-30 18:29:34 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe Gitlab::RequestProfiler do
|
2017-04-30 18:29:34 -04:00
|
|
|
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
|