Sha256: 6d6fe400f1c4dc6b867a64e5fdb9a5ac89526cf3edcc466095967862d44490ac

Contents?: true

Size: 835 Bytes

Versions: 2

Compression:

Stored size: 835 Bytes

Contents

module RSpec
  module Sidekiq
    module Matchers
      def be_processed_in expected
        BeProcessedIn.new expected
      end

      class BeProcessedIn
        def initialize expected
          @expected = expected
        end

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

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

        def matches? job
          @klass = job.kind_of?(Class) ? job : job.class
          @actual = @klass.get_sidekiq_options["queue"]
          @actual.to_s == @expected.to_s
        end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-sidekiq-0.5.1 lib/rspec/sidekiq/matchers/be_processed_in.rb
rspec-sidekiq-0.5.0 lib/rspec/sidekiq/matchers/be_processed_in.rb