gitlab-org--gitlab-foss/spec/lib/gitlab/request_profiler_spec.rb
2017-07-27 14:31:53 +02:00

27 lines
654 B
Ruby

require 'spec_helper'
describe Gitlab::RequestProfiler 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