Skip to content
Browse files

Testing refactoring.

  • Loading branch information...
1 parent 554d266 commit b703e3417926a9a1cb41efdfe469226210e9649d @treeder treeder committed Dec 1, 2011
Showing with 57 additions and 19 deletions.
  1. +2 −1 .gitignore
  2. +1 −1 ironmq.gemspec
  3. +1 −1 test/long_run.rb
  4. +28 −0 test/quick_run.rb
  5. +21 −0 test/test_base.rb
  6. +4 −16 test/test_ironmq.rb
View
3 .gitignore
@@ -1,6 +1,7 @@
.DS_Store
-pkg
+pkg/
doc
.idea
log
test/config.yml
+*.sublime*
View
2 ironmq.gemspec
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
"lib/ironmq.rb",
"lib/ironmq/client.rb",
"lib/ironmq/messages.rb",
- "test/ironmq_tests.rb",
+ "test/test_ironmq.rb",
"test/long_run.rb"
]
s.homepage = %q{http://www.iron.io}
View
2 test/long_run.rb
@@ -1,7 +1,7 @@
require 'yaml'
require 'concur'
begin
- require File.join(File.dirname(__FILE__), '../lib/ironmq')
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'ironmq')
rescue Exception => ex
puts "Could NOT load current ironmq: " + ex.message
raise ex
View
28 test/quick_run.rb
@@ -0,0 +1,28 @@
+# Put config.yml file in ~/Dropbox/configs/ironmq_gem/test/config.yml
+require_relative 'test_base'
+
+class QuickRun < TestBase
+
+ def setup
+ super
+ @client.queue_name = 'ironmq-gem-quick'
+end
+
+ def test_basics
+ res = @client.messages.post("hello world!")
+ p res
+
+ res = @client.messages.get()
+ p res
+
+ res = @client.messages.delete(res["id"])
+ p res
+
+ res = @client.messages.get()
+ p res
+
+ end
+
+
+end
+
View
21 test/test_base.rb
@@ -0,0 +1,21 @@
+gem 'test-unit'
+require 'test/unit'
+require 'yaml'
+begin
+ require File.join(File.dirname(__FILE__), '../lib/ironmq')
+rescue Exception => ex
+ puts "Could NOT load current ironmq: " + ex.message
+ raise ex
+end
+
+
+class TestBase < Test::Unit::TestCase
+ def setup
+ puts 'setup'
+ @config = YAML::load_file(File.expand_path(File.join("~", "Dropbox", "configs", "ironmq_gem", "test", "config.yml")))
+ @client = IronMQ::Client.new(@config['ironmq'])
+ @client.logger.level = Logger::DEBUG
+ @client.queue_name = 'ironmq-ruby-tests'
+
+ end
+end
View
20 test/test_ironmq.rb
@@ -3,23 +3,11 @@
gem 'test-unit'
require 'test/unit'
require 'yaml'
-begin
- require File.join(File.dirname(__FILE__), '../lib/ironmq')
-rescue Exception => ex
- puts "Could NOT load current ironmq: " + ex.message
- raise ex
-end
-
-class IronMQTests < Test::Unit::TestCase
- def setup
- puts 'setup'
- @config = YAML::load_file(File.expand_path(File.join("~", "Dropbox", "configs", "ironmq_gem", "test", "config.yml")))
- @client = IronMQ::Client.new(@config['ironmq'])
- #@client.logger.level = Logger::DEBUG
- @client.queue_name = 'ironmq-tests'
+require_relative 'test_base'
- queue = @client.queues.get(:name=>@client.queue_name)
- puts 'queue size=' + queue.size.to_s
+class IronMQTests < TestBase
+ def setup
+ super
puts 'clearing queue'
while res = @client.messages.get()

0 comments on commit b703e34

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