Skip to content

Commit

Permalink
Merge pull request #6 from erikogan/jimmy-is-a-racist
Browse files Browse the repository at this point in the history
Update the default TERM_PATTERN to allow for unicode word characters
  • Loading branch information
jimmycuadra committed Feb 5, 2014
2 parents 2a2f800 + 4121996 commit bc820fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/lita/handlers/karma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Lita
module Handlers
# Tracks karma points for arbitrary terms.
class Karma < Handler
TERM_PATTERN = /[\[\]\w\._|\{\}]{2,}/
TERM_PATTERN = /[\[\]\p{Word}\._|\{\}]{2,}/

class << self
attr_accessor :term_pattern
Expand Down
6 changes: 6 additions & 0 deletions spec/lita/handlers/karma_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Encoding: UTF-8
require "spec_helper"

describe Lita::Handlers::Karma, lita_handler: true do
Expand Down Expand Up @@ -68,6 +69,11 @@
send_message("FOO++")
expect(replies.last).to eq("foo: 2")
end

it "handles Unicode word characters" do
send_message("föö++")
expect(replies.last).to eq("föö: 1")
end
end

describe "#decrement" do
Expand Down

0 comments on commit bc820fc

Please sign in to comment.