Sha256: 795964d9545e8d9fe87ca2d6aa33872a5dcb606ec4c43c731bcb1744f0bf1d09

Contents?: true

Size: 1.27 KB

Versions: 31

Compression:

Stored size: 1.27 KB

Contents

module RSpec
  module Sidekiq
    module Matchers

      #
      # original version here:
      #  https://github.com/philostler/rspec-sidekiq/blob/develop/lib/rspec/sidekiq/matchers/be_processed_in.rb
      #
      #  this matcher needs to read off the actual queue name used, from the job array
      #  instead of reading off the job classes configuration
      #

      def be_processed_in_x(expected_queue)
        BeProcessedInX.new expected_queue
      end

      class BeProcessedInX
        def initialize(expected_queue)
          @expected_queue = expected_queue
        end

        def description
          "be processed in the \"#{@expected_queue}\" queue"
        end

        def failure_message
          "expected #{@klass} to be processed in the \"#{@expected_queue}\" queue but got \"#{@actual}\""
        end

        # NOTE: expects only one job in the queue, so don't forget to clear down the fake queue before each spec
        def matches?(job)
          @klass = job.is_a?(Class) ? job : job.class
          entry = @klass.jobs.first
          entry && (entry['queue'] == @expected_queue.to_s)
        end

        def failure_message_when_negated
          "expected #{@klass} to not be processed in the \"#{@expected_queue}\" queue"
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
taskinator-0.5.2 spec/support/sidekiq_matchers.rb
taskinator-0.5.1 spec/support/sidekiq_matchers.rb
taskinator-0.5.0 spec/support/sidekiq_matchers.rb
taskinator-0.4.7 spec/support/sidekiq_matchers.rb
taskinator-0.4.6 spec/support/sidekiq_matchers.rb
taskinator-0.4.5 spec/support/sidekiq_matchers.rb
taskinator-0.4.4 spec/support/sidekiq_matchers.rb
taskinator-0.4.3 spec/support/sidekiq_matchers.rb
taskinator-0.4.2 spec/support/sidekiq_matchers.rb
taskinator-0.4.1 spec/support/sidekiq_matchers.rb
taskinator-0.4.0 spec/support/sidekiq_matchers.rb
taskinator-0.3.16 spec/support/sidekiq_matchers.rb
taskinator-0.3.15 spec/support/sidekiq_matchers.rb
taskinator-0.3.14 spec/support/sidekiq_matchers.rb
taskinator-0.3.13 spec/support/sidekiq_matchers.rb
taskinator-0.3.12 spec/support/sidekiq_matchers.rb
taskinator-0.3.11 spec/support/sidekiq_matchers.rb
taskinator-0.3.10 spec/support/sidekiq_matchers.rb
taskinator-0.3.9 spec/support/sidekiq_matchers.rb
taskinator-0.3.7 spec/support/sidekiq_matchers.rb