From d5d9fee964637ea3e68b56f67cbbada4be3b8eaa Mon Sep 17 00:00:00 2001 From: Tristan Chong Date: Sat, 3 May 2014 22:43:43 -0700 Subject: [PATCH 1/2] test that "g " routes to search --- spec/lita/handlers/google_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/lita/handlers/google_spec.rb b/spec/lita/handlers/google_spec.rb index 4331fde..72557df 100644 --- a/spec/lita/handlers/google_spec.rb +++ b/spec/lita/handlers/google_spec.rb @@ -3,6 +3,7 @@ describe Lita::Handlers::Google, lita_handler: true do it { routes_command("google ruby").to(:search) } it { routes_command("google me ruby").to(:search) } + it { routes_command("g ruby").to(:search) } describe "#search" do let(:response) do From 1756f66cc3ebbaa27db60ba447974e422c07639a Mon Sep 17 00:00:00 2001 From: Tristan Chong Date: Sat, 3 May 2014 22:44:38 -0700 Subject: [PATCH 2/2] route command g to search --- lib/lita/handlers/google.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lita/handlers/google.rb b/lib/lita/handlers/google.rb index 0c9e5f7..5ea0117 100644 --- a/lib/lita/handlers/google.rb +++ b/lib/lita/handlers/google.rb @@ -8,7 +8,7 @@ module Handlers class Google < Handler URL = "https://ajax.googleapis.com/ajax/services/search/web" - route(/^google\s+(.+)/i, :search, command: true, help: { + route(/^(?:google|g)\s+(.+)/i, :search, command: true, help: { "google QUERY" => "Return the first Google search result for QUERY." })