Skip to content

Commit

Permalink
Simple spec file, showing the this issue with doubled routes
Browse files Browse the repository at this point in the history
  • Loading branch information
directionless committed Feb 12, 2016
1 parent 0b19d2e commit 6983d3f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/lita/handlers/karma/chat2_spec.rb
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

0 comments on commit 6983d3f

Please sign in to comment.