aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/queueing/container_test.rb
blob: 7afc11e7a91647ebaf5922dc7ba8e12fe5eec1aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'abstract_unit'
require 'active_support/queueing'

module ActiveSupport
  class ContainerTest < ActiveSupport::TestCase
    def test_delegates_to_default
      q         = Queue.new
      container = QueueContainer.new q
      job       = Object.new

      container.push job
      assert_equal job, q.pop
    end

    def test_access_default
      q         = Queue.new
      container = QueueContainer.new q
      assert_equal q, container[:default]
    end

    def test_assign_queue
      container = QueueContainer.new Object.new
      q         = Object.new
      container[:foo] = q
      assert_equal q, container[:foo]
    end
  end
end