Permalink
Browse files

Account for empty strings in the command string after the split

  • Loading branch information...
1 parent 394b4dc commit 222c84eddefa5358eb141f3b266d886f6bd81579 @steelThread committed Oct 20, 2012
Showing with 3 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +1 −0 lib/redmon/app.rb
  3. +1 −1 spec/app_spec.rb
View
@@ -4,4 +4,5 @@
.DS_Store
dump.rdb
pkg
+vendor
Gemfile.lock
View
@@ -25,6 +25,7 @@ class App < Sinatra::Base
get '/cli' do
args = params[:command].split(/ *"(.*?)" *| *'(.*?)' *| /)
+ args.reject!(&:blank?)
@cmd = args.shift.downcase.intern
begin
raise RuntimeError unless supported? @cmd
View
@@ -42,7 +42,7 @@ def stub_redis_cmd(cmd, *args)
it "should execute a passed command with quoted values" do
stub_redis_cmd :set, 'key', 'quoted value'
- get URI.encode('/cli?command=set key "quoted value"')
+ get URI.encode('/cli?command=set key "quoted value"')
last_response.should be_ok
end

0 comments on commit 222c84e

Please sign in to comment.