disc 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Makefile +2 -2
- data/README.md +1 -0
- data/examples/disc_init.rb +2 -1
- data/examples/echoer.rb +12 -0
- data/lib/disc/version.rb +1 -1
- data/lib/disc.rb +1 -1
- data/test/disc_test.rb +28 -6
- metadata +3 -3
- data/examples/active_job.rb +0 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3ecc3356891d074ac864ebe024fdab7f8882d1e3
         | 
| 4 | 
            +
              data.tar.gz: 48318efa3c5ad39de7cf86e6fe632e73cc1cbcb0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 89f834da2af8da0a89f4a8d2eed744f0739b80c9f7d1ca2ae49c3a803815653affe16589c5708bfaf5314edd841d8327308ab0a7144ab4585f68fceb6228baaf
         | 
| 7 | 
            +
              data.tar.gz: 2afe64e1c088273a968db54d41531ca2ad9294f717d48ee743955c67d4f51b14ee3c431ede0e248aadfd5ad444bcd9485170de04a3a2c1faab81fa293e54e2d1
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/Makefile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    
    
        data/examples/disc_init.rb
    CHANGED
    
    | @@ -1 +1,2 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            $:.unshift('lib')
         | 
| 2 | 
            +
            Dir.glob("./examples/**/*.rb") { |f| require f }
         | 
    
        data/examples/echoer.rb
    ADDED
    
    
    
        data/lib/disc/version.rb
    CHANGED
    
    
    
        data/lib/disc.rb
    CHANGED
    
    
    
        data/test/disc_test.rb
    CHANGED
    
    | @@ -1,22 +1,44 @@ | |
| 1 1 | 
             
            $: << 'lib'
         | 
| 2 2 | 
             
            require 'cutest'
         | 
| 3 3 | 
             
            require 'disc'
         | 
| 4 | 
            +
            require 'msgpack'
         | 
| 4 5 |  | 
| 5 6 | 
             
            class TestJob
         | 
| 6 7 | 
             
              include Disc::Job
         | 
| 7 8 | 
             
              disc queue: 'test_urgent'
         | 
| 8 9 |  | 
| 9 | 
            -
              def perform( | 
| 10 | 
            -
                puts  | 
| 10 | 
            +
              def perform(first, second, third)
         | 
| 11 | 
            +
                puts "First: #{ first }"
         | 
| 12 | 
            +
                puts "Second: #{ second }"
         | 
| 13 | 
            +
                puts "Third: #{ third }"
         | 
| 11 14 | 
             
              end
         | 
| 12 15 | 
             
            end
         | 
| 13 16 |  | 
| 17 | 
            +
            prepare do
         | 
| 18 | 
            +
              Disc.disque.call('DEBUG', 'FLUSHALL')
         | 
| 19 | 
            +
            end
         | 
| 20 | 
            +
             | 
| 14 21 | 
             
            scope do
         | 
| 15 | 
            -
              test ' | 
| 16 | 
            -
                 | 
| 22 | 
            +
              test 'jobs are enqueued to the correct Disque queue with appropriate parameters and class' do
         | 
| 23 | 
            +
                TestJob.enqueue('one argument', { random: 'data' }, 3)
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                jobs = Array(Disc.disque.fetch(from: ['test_urgent'], timeout: Disc.disque_timeout, count: 1))
         | 
| 26 | 
            +
                assert jobs.any?
         | 
| 27 | 
            +
                assert_equal 1, jobs.count
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                jobs.first.tap do |queue, _, serialized_job|
         | 
| 30 | 
            +
                  job = MessagePack.unpack(serialized_job)
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  assert job.has_key?('class')
         | 
| 33 | 
            +
                  assert job.has_key?('arguments')
         | 
| 17 34 |  | 
| 18 | 
            -
             | 
| 35 | 
            +
                  assert_equal 'TestJob', job['class']
         | 
| 19 36 |  | 
| 20 | 
            -
             | 
| 37 | 
            +
                  args = job['arguments']
         | 
| 38 | 
            +
                  assert_equal 3, args.size
         | 
| 39 | 
            +
                  assert_equal 'one argument', args[0]
         | 
| 40 | 
            +
                  assert_equal({ 'random' => 'data' }, args[1])
         | 
| 41 | 
            +
                  assert_equal(3, args[2])
         | 
| 42 | 
            +
                end
         | 
| 21 43 | 
             
              end
         | 
| 22 44 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: disc
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.11
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - pote
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-07- | 
| 11 | 
            +
            date: 2015-07-16 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: disque
         | 
| @@ -69,8 +69,8 @@ files: | |
| 69 69 | 
             
            - README.md
         | 
| 70 70 | 
             
            - bin/disc
         | 
| 71 71 | 
             
            - disc.gemspec
         | 
| 72 | 
            -
            - examples/active_job.rb
         | 
| 73 72 | 
             
            - examples/disc_init.rb
         | 
| 73 | 
            +
            - examples/echoer.rb
         | 
| 74 74 | 
             
            - examples/fail_job.rb
         | 
| 75 75 | 
             
            - examples/greeter.rb
         | 
| 76 76 | 
             
            - lib/active_job/queue_adapters/disc_adapter.rb
         |