Skip to content
Browse files

Cgi escapes queue names, closes #26

  • Loading branch information...
1 parent 0b26925 commit 22e2e0077db79970fa9b7cf176ff68b14e099351 @treeder treeder committed
Showing with 46 additions and 10 deletions.
  1. +7 −5 Gemfile.lock
  2. +1 −0 iron_mq.gemspec
  3. +3 −1 lib/iron_mq/messages.rb
  4. +2 −0 lib/iron_mq/queues.rb
  5. +33 −4 test/tmp.rb
View
12 Gemfile.lock
@@ -14,22 +14,23 @@ GEM
faraday (0.8.4)
multipart-post (~> 1.1)
ffi (1.1.5)
- iron_core (0.4.2)
+ iron_core (0.4.3)
rest (>= 2.0.2)
mime-types (1.19)
+ minitest (4.1.0)
multipart-post (1.1.5)
- net-http-persistent (2.7)
+ net-http-persistent (2.8)
rake (0.9.2.2)
- rest (2.0.2)
+ rest (2.0.4)
net-http-persistent
rest-client (>= 0.3.0)
rest-client (1.6.7)
mime-types (>= 1.16)
- test-unit (2.5.1)
+ test-unit (2.5.2)
typhoeus (0.4.2)
ffi (~> 1.0)
mime-types (~> 1.18)
- uber_config (0.0.6)
+ uber_config (1.0.5)
PLATFORMS
ruby
@@ -38,6 +39,7 @@ DEPENDENCIES
beanstalk-client
concur
iron_mq!
+ minitest
net-http-persistent
rake
test-unit
View
1 iron_mq.gemspec
@@ -19,6 +19,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency "iron_core", ">= 0.4.2"
gem.add_development_dependency "test-unit"
+ gem.add_development_dependency "minitest"
gem.add_development_dependency "rake"
gem.add_development_dependency "beanstalk-client"
gem.add_development_dependency "uber_config"
View
4 lib/iron_mq/messages.rb
@@ -1,3 +1,5 @@
+require 'cgi'
+
module IronMQ
class Messages
@@ -8,7 +10,7 @@ def initialize(client)
end
def path(options={})
- path = "projects/#{@client.project_id}/queues/#{options[:queue_name] || options['queue_name'] || @client.queue_name}/messages"
+ path = "projects/#{@client.project_id}/queues/#{CGI::escape(options[:queue_name] || options['queue_name'] || @client.queue_name)}/messages"
end
# options:
View
2 lib/iron_mq/queues.rb
@@ -1,3 +1,5 @@
+require 'cgi'
+
module IronMQ
class Queues
View
37 test/tmp.rb
@@ -1,7 +1,3 @@
-# Put config.yml file in ~/Dropbox/configs/ironmq_gem/test/config.yml
-
-#$abt_config = {:hello=>'abt_config_ya'}
-
gem 'test-unit'
require 'test/unit'
require 'yaml'
@@ -11,6 +7,39 @@ class IronMQTests < TestBase
def setup
super
+ @queue_name = "fixed_num2_migration"
+
+ end
+
+ def test_put_x
+ q = @client.queue(@queue_name)
+ 1000.times do |i|
+ puts "#{i}"
+ q.post("msg #{i}")
+ end
+ p q.reload.size
+ assert_equal 1800, q.size
+ end
+
+ def test_get_x
+ #q = @client.queue(@queue_name)
+ #puts "q.size: #{q.size}"
+ #100.times do |i|
+ # puts "#{i}"
+ # msg = q.get
+ # msg.delete
+ #end
+ #p q.reload.size
+ #assert_equal 900, q.reload.size
end
+ #
+ #def test_poll_all
+ # q = @client.queue(@queue_name)
+ # puts "q.size: #{q.size}"
+ # q.poll do |msg|
+ # p msg
+ # end
+ # p queue.reload.size
+ #end
end

0 comments on commit 22e2e00

Please sign in to comment.
Something went wrong with that request. Please try again.