Skip to content

Commit

Permalink
For #5, fix the tests
Browse files Browse the repository at this point in the history
- custom filter will nil everything, truncating is not permitted
- register filters/filter words with logger instance
  • Loading branch information
jfinkhaeuser committed Jul 6, 2015
1 parent dadfaf9 commit 45468a5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions features/step_definitions/filter_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,23 @@
end

Given(/^I set filter words to include "([^"]*)"$/) do |filter_word|
TeeLogger::Filter.filter_words = [filter_word]
logger.filter_words = [filter_word]
end

Given(/^I register a custom filter$/) do
class MyFilter < TeeLogger::Filter::FilterBase
FILTER_TYPES = [String]
WINDOW_SIZE = 1
def process(*args)
# Eat all arguments
return []
# Nil everything
args.each_with_index do |dummy, idx|
args[idx] = nil
end
return args
end
end

TeeLogger::Filter.register_filter(MyFilter)
logger.register_filter(MyFilter)
end

Given(/^I write a log message containing the word sequence "([^"]*)", "([^"]*)"$/) do |word1, word2|
Expand Down

0 comments on commit 45468a5

Please sign in to comment.