From f0c440b8844778808b190360fa484d7e527bb746 Mon Sep 17 00:00:00 2001 From: Jaiden Mispy <^_^@mispy.me> Date: Tue, 16 Dec 2014 08:28:52 +1100 Subject: [PATCH] Test for and fix username case inconsistencies --- lib/twitter_ebooks/bot.rb | 3 +-- spec/bot_spec.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/twitter_ebooks/bot.rb b/lib/twitter_ebooks/bot.rb index 782458e..568f06c 100644 --- a/lib/twitter_ebooks/bot.rb +++ b/lib/twitter_ebooks/bot.rb @@ -84,8 +84,7 @@ module Ebooks # Process mentions to figure out who to reply to # i.e. not self and nobody who has seen too many secondary mentions reply_mentions = @mentions.reject do |m| - username = m.downcase - username == @bot.username || !@bot.conversation(ev).can_include?(username) + m.downcase == @bot.username.downcase || !@bot.conversation(ev).can_include?(m) end @reply_mentions = ([ev.user.screen_name] + reply_mentions).uniq diff --git a/spec/bot_spec.rb b/spec/bot_spec.rb index 57a0ce7..ba07a4d 100644 --- a/spec/bot_spec.rb +++ b/spec/bot_spec.rb @@ -83,7 +83,7 @@ end describe Ebooks::Bot do include Ebooks::Test - let(:bot) { TestBot.new('test_ebooks') } + let(:bot) { TestBot.new('Test_Ebooks') } before { Timecop.freeze } after { Timecop.return }