discourse/plugins/discourse-nginx-performance-report/spec/line_parser_spec.rb
Sam Saffron 30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00

16 lines
541 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
require_relative '../lib/log_analyzer'
describe LogAnalyzer::LineParser do
describe '.parse' do
let(:line) { '[22/Sep/2016:07:32:00 +0000] 172.0.0.1 "GET /about.json?api_username=system&api_key=1234567 HTTP/1.1" "Some usename" "about/index" 200 1641 "-" 0.014 0.014 "system"' }
it "should filter out the api_key" do
result = described_class.parse(line)
expect(result.url).to eq('GET /about.json?api_username=system&api_key=[FILTERED] HTTP/1.1')
end
end
end