Sha256: 22c63820cb9cee563c111b23b73c5ee428e724009402a2868005fdde6c50305b

Contents?: true

Size: 626 Bytes

Versions: 3

Compression:

Stored size: 626 Bytes

Contents

module RSpec
  module Sidekiq
    module Matchers
      def be_unique
        BeUnique.new
      end

      class BeUnique
        def description
          'be unique in the queue'
        end

        def failure_message
          "expected #{@klass} to be unique in the queue"
        end

        def matches?(job)
          @klass = job.is_a?(Class) ? job : job.class
          @actual = @klass.get_sidekiq_options['unique']
          [true, :all].include?(@actual)
        end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspec-sidekiq-2.2.0 lib/rspec/sidekiq/matchers/be_unique.rb
rspec-sidekiq-2.1.0 lib/rspec/sidekiq/matchers/be_unique.rb
rspec-sidekiq-2.0.0 lib/rspec/sidekiq/matchers/be_unique.rb