Sha256: 7f8e6be373bd552c4f60aceaf58f2c88bf44878f95aeebe44f40ec3e1f71f5bc

Contents?: true

Size: 772 Bytes

Versions: 2

Compression:

Stored size: 772 Bytes

Contents

require 'spec_helper'
require 'sidekiq-apriori/worker'

describe Sidekiq::Apriori::Worker do
  before(:all) do
    class Job
      def perform; end
      include Sidekiq::Apriori::Worker
    end
  end

  let(:job) { Job.new }

  ## Checking for ruby 2
  #
  if ( RUBY_VERSION.split(/\./).map(&:to_i) rescue [] ).first > 1
    it "redefines 'perform' to handle an extra argument when that argument has priority information" do
      job.should be_an_instance_of(Job)
      expect { job.perform(priority: "high") }.not_to raise_error
    end

    it "does not rescue errors with incorrectly formatted priority information" do
      expect { job.perform("high") }.to raise_error(ArgumentError)
      expect { job.perform({}) }.to raise_error(ArgumentError)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-apriori-0.0.3 spec/sidekiq-apriori/worker_spec.rb
sidekiq-apriori-0.0.2 spec/sidekiq-apriori/worker_spec.rb