Sha256: 6f37a7e0af9bc64cf9c629cd63e04c5815a65a979642acae3b16e84e2637d46b

Contents?: true

Size: 1.05 KB

Versions: 12

Compression:

Stored size: 1.05 KB

Contents

require File.dirname(__FILE__) + '/../lib/sweat_shop'
require File.dirname(__FILE__) + '/test_helper'
require File.dirname(__FILE__) + '/hello_worker'

class WorkerTest < Test::Unit::TestCase

  def setup
    File.delete(HelloWorker::TEST_FILE) if File.exist?(HelloWorker::TEST_FILE)
  end

  def teardown
    File.delete(HelloWorker::TEST_FILE) if File.exist?(HelloWorker::TEST_FILE)
  end

  test "daemon" do
    begin
      SweatShop.queue = nil
      SweatShop.logger = :silent

      worker = File.expand_path(File.dirname(__FILE__) + '/hello_worker')
      sweatd = "#{File.dirname(__FILE__)}/../lib/sweat_shop/sweatd.rb" 
      uid = HelloWorker.async_hello('Amos')

      `ruby #{sweatd} --worker-file #{worker} start`
      `ruby #{sweatd} stop`

      File.delete('sweatd.log') if File.exist?('sweatd.log')
      assert_equal 'Hi, Amos', File.read(HelloWorker::TEST_FILE)
    rescue Exception => e
      puts e.message
      puts e.backtrace.join("\n")
      fail "\n\n*** Functional test failed, is the rabbit server running on localhost? ***\n"
    end
  end
  
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
Bira-sweat_shop-1.0.0 test/test_functional_worker.rb
famoseagle-sweat_shop-0.5.0 test/test_functional_worker.rb
famoseagle-sweat_shop-0.6.0 test/test_functional_worker.rb
famoseagle-sweat_shop-0.7.0 test/test_functional_worker.rb
famoseagle-sweat_shop-0.8.0 test/test_functional_worker.rb
famoseagle-sweat_shop-0.8.1 test/test_functional_worker.rb
famoseagle-sweat_shop-0.8.2 test/test_functional_worker.rb
famoseagle-sweat_shop-1.0.0 test/test_functional_worker.rb
famoseagle-sweat_shop-1.1.0 test/test_functional_worker.rb
famoseagle-sweat_shop-1.2.0 test/test_functional_worker.rb
famoseagle-sweat_shop-1.3.0 test/test_functional_worker.rb
famoseagle-sweat_shop-1.3.1 test/test_functional_worker.rb