forked from jimmycuadra/lita-karma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simple spec file, showing the this issue with doubled routes
- Loading branch information
1 parent
0b19d2e
commit 6983d3f
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
require "spec_helper" | ||
|
||
describe Lita::Handlers::Karma::Chat, lita_handler: true do | ||
let(:payload) { double("payload") } | ||
|
||
prepend_before do | ||
unless registry.handlers.include?(Lita::Handlers::Karma::Config) | ||
registry.register_handler(Lita::Handlers::Karma::Config) | ||
end | ||
end | ||
|
||
before do | ||
registry.config.handlers.karma.cooldown = nil | ||
registry.config.handlers.karma.link_karma_threshold = nil | ||
described_class.routes.clear | ||
subject.define_routes(payload) | ||
end | ||
|
||
describe "#increment" do | ||
it "I should only have one increment route" do | ||
#bindings.pry | ||
matching_routes = described_class.routes.select {|r| r.callback.inspect.match(/increment/) } | ||
expect(matching_routes.length).to eq(1) | ||
end | ||
|
||
it "increases the term's score by one and says the new score" do | ||
send_message("ffoo++") | ||
expect(replies.last).to eq("ffoo: 1") | ||
end | ||
end | ||
|
||
|
||
end |