Skip to content

Commit

Permalink
actually calls update method in mutate + coverage test
Browse files Browse the repository at this point in the history
  • Loading branch information
wiibaa committed May 8, 2013
1 parent 3efcb9e commit 7a64369
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/logstash/filters/mutate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def filter(event)
return unless filter?(event)

rename(event) if @rename
update(event) if @update
replace(event) if @replace
convert(event) if @convert
gsub(event) if @gsub
Expand Down
3 changes: 3 additions & 0 deletions spec/filters/mutate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
replace => [ "replaceme", "hello world" ]
replace => [ "newfield", "newnew" ]
update => [ "nosuchfield", "weee" ]
update => [ "updateme", "updated" ]
remove => [ "removeme" ]
}
}
Expand All @@ -26,6 +27,7 @@
"intme" => [ "1234", "7890.4", "7.9" ],
"floatme" => [ "1234.455" ],
"rename1" => [ "hello world" ],
"updateme" => [ "who cares" ],
"replaceme" => [ "who cares" ],
"removeme" => [ "something" ]
}
Expand All @@ -43,6 +45,7 @@
insist { subject }.include?("newfield")
insist { subject["newfield"] } == "newnew"
reject { subject }.include?("nosuchfield")
insist { subject["updateme"] } == "updated"
end
end

Expand Down

0 comments on commit 7a64369

Please sign in to comment.