Sha256: f2f4292e88dcc7222a12e6d88900b8c37db114ba686892b57faa22369a7b7e2e

Contents?: true

Size: 836 Bytes

Versions: 3

Compression:

Stored size: 836 Bytes

Contents

require 'test_helper'

class LocaljobTest < LocaljobTestCase
  def setup
    @localjob = queue
  end

  def test_push_should_put_a_job_in_queue
    @localjob << WalrusJob.new("move")
    assert_equal 1, @localjob.size
  end

  def test_pop_from_queue
    @localjob << WalrusJob.new("move")

    job = @localjob.shift
    assert_instance_of WalrusJob, job
    assert_equal "move", job.action
  end

  def test_handles_multiple_queues
    @localjob << WalrusJob.new("move")

    other = queue("other-queue")
    other << WalrusJob.new("dance")

    assert_equal 1, @localjob.size
    assert_equal 1, other.size
  end

  on_platform 'linux' do
    def test_throws_error_if_message_is_too_large
      assert_raises Errno::EMSGSIZE do
        @localjob << AngryWalrusJob.new("f" * @localjob.queue.mqueue.msgsize)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
localjob-0.1.1 test/localjob_test.rb
localjob-0.1.0 test/localjob_test.rb
localjob-0.0.2 test/localjob_test.rb