Sha256: aeca80f1ff72d43e686345e7b49e36d59e2d1c046984dbd6a36bc154ef5d867f
Contents?: true
Size: 1.96 KB
Versions: 11
Compression:
Stored size: 1.96 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' require 'request_log_analyzer/log_processor' describe RequestLogAnalyzer::LogProcessor, 'anonymization' do include RequestLogAnalyzerSpecHelper before(:each) do @log_anonymizer = RequestLogAnalyzer::LogProcessor.new(spec_format, :anonymize, {}) @alternate_log_anonymizer = RequestLogAnalyzer::LogProcessor.new(spec_format, :anonymize, {:keep_junk_lines => true, :discard_teaser_lines => true}) end it "should keep a junk line if :keep_junk_lines is true" do @alternate_log_anonymizer.anonymize_line("junk line\n").should == "junk line\n" end it "should remove a junk line" do @log_anonymizer.anonymize_line("junk line\n").should be_empty end it "should keep a teaser line intact" do @log_anonymizer.anonymize_line("processing 1234\n").should == "processing 1234\n" end it "should discard a teaser line if discard_teaser_line is true" do @alternate_log_anonymizer.anonymize_line("processing 1234\n").should be_empty end it "should keep a matching line intact if no anonymizing is declared" do @alternate_log_anonymizer.anonymize_line("finishing request 130\n").should == "finishing request 130\n" end it "should anonymize values completely if requested" do @alternate_log_anonymizer.anonymize_line("testing is great\n").should == "testing is ***\n" end it "should anonymize values slightly if requested" do @alternate_log_anonymizer.anonymize_line("finishing request 130\n").should =~ /^finishing request 1\d\d\n$/ end end describe RequestLogAnalyzer::LogProcessor, 'stripping log files' do include RequestLogAnalyzerSpecHelper before(:each) do @log_stripper = RequestLogAnalyzer::LogProcessor.new(spec_format, :strip, {}) end it "should remove a junk line" do @log_stripper.strip_line("junk line\n").should be_empty end it "should keep a teaser line intact" do @log_stripper.strip_line("processing 1234\n").should be_empty end end
Version data entries
11 entries across 11 versions & 2 rubygems