Sha256: b28f441a0f618c781047482c788f03ab0acd7079bc7def4434b3edaf4510aae4

Contents?: true

Size: 779 Bytes

Versions: 7

Compression:

Stored size: 779 Bytes

Contents

module RSpec
  module Sidekiq
    module Spec
      module Support
        module Factories
          def create_worker(options = {})
            clazz_name = "Worker#{ rand(36**10).to_s 36 }"
            clazz = Class.new do
              include ::Sidekiq::Worker

              sidekiq_options options

              def perform
              end
            end
            Object.const_set clazz_name, clazz
          end

          def create_active_job(options = {})
            clazz_name = "ActiveJob#{ rand(36**10).to_s 36 }"
            clazz = Class.new(ActiveJob::Base) do
              queue_as options

              def perform
              end
            end
            Object.const_set clazz_name, clazz
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rspec-sidekiq-3.1.0 spec/support/factories.rb
rspec-sidekiq-3.0.3 spec/support/factories.rb
rspec-sidekiq-3.0.2 spec/support/factories.rb
rspec-sidekiq-3.0.1 spec/support/factories.rb
rspec-sidekiq-3.0.0 spec/support/factories.rb
rspec-sidekiq-2.2.0 spec/support/factories.rb
rspec-sidekiq-2.1.0 spec/support/factories.rb