Commit 589096dc authored by James Lopez's avatar James Lopez

refactor code

parent b868f90d
......@@ -9,7 +9,7 @@ module Gitlab
def log
return unless ::License.feature_available?(:ide)
::Gitlab::AppLogger.info({test: 1})
Rails.logger.info("Web editor usage - #{metric_info}")
end
......
......@@ -6,25 +6,23 @@ describe Gitlab::Metrics::MultiFileEditor do
subject { described_class.new(project, user, project.commit('b83d6e391c22777fca1ed3012fce84f633d7fed0')) }
describe '.record' do
describe 'metrics' do
it 'has the right log info' do
stub_licensed_features(ide: true)
describe '.log' do
it 'has the right log info' do
stub_licensed_features(ide: true)
info = "Web editor usage - ide_usage_project_id: #{project.id}, ide_usage_user: #{user.id}, ide_usage_line_count: 1, ide_usage_file_count: 1"
info = "Web editor usage - ide_usage_project_id: #{project.id}, ide_usage_user: #{user.id}, ide_usage_line_count: 1, ide_usage_file_count: 1"
expect(Rails.logger).to receive(:info).with(info)
expect(Rails.logger).to receive(:info).with(info)
subject.log
end
subject.log
end
it 'does not log any info if IDE is disabled' do
info = "Web editor usage - ide_usage_project_id: #{project.id}, ide_usage_user: #{user.id}, ide_usage_line_count: 1, ide_usage_file_count: 1"
it 'does not log any info if IDE is disabled' do
info = "Web editor usage - ide_usage_project_id: #{project.id}, ide_usage_user: #{user.id}, ide_usage_line_count: 1, ide_usage_file_count: 1"
expect(Rails.logger).not_to receive(:info).with(info)
expect(Rails.logger).not_to receive(:info).with(info)
subject.log
end
subject.log
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment