Sha256: ead0fba4f56f055c967f538a836bf51334191e25ebd94f1aad07041a0f70de21

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

if DependencyHelper.resque_present? && DependencyHelper.active_job_present?
  describe "Resque ActiveJob integration" do
    let(:file) { File.expand_path("lib/appsignal/integrations/resque_active_job.rb") }

    context "with Resque and ActiveJob" do
      before do
        load file
        start_agent

        class TestActiveJob < ActiveJob::Base
          include Appsignal::Integrations::ResqueActiveJobPlugin

          def perform(param)
          end
        end
      end

      describe :around_perform_plugin do
        before    { allow(SecureRandom).to receive(:uuid).and_return(123) }
        let(:job) { TestActiveJob.new("moo") }

        it "should wrap in a transaction with the correct params" do
          expect(Appsignal).to receive(:monitor_single_transaction).with(
            "perform_job.resque",
            :class  => "TestActiveJob",
            :method => "perform",
            :params => ["moo"],
            :metadata => {
              :id    => 123,
              :queue => "default"
            }
          )
        end
        after { job.perform_now }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
appsignal-2.2.1 spec/lib/appsignal/integrations/resque_active_job_spec.rb
appsignal-2.2.0 spec/lib/appsignal/integrations/resque_active_job_spec.rb
appsignal-2.2.0.beta.1 spec/lib/appsignal/integrations/resque_active_job_spec.rb
appsignal-2.1.2 spec/lib/appsignal/integrations/resque_active_job_spec.rb
appsignal-2.1.1 spec/lib/appsignal/integrations/resque_active_job_spec.rb
appsignal-2.1.1.beta.1 spec/lib/appsignal/integrations/resque_active_job_spec.rb
appsignal-2.1.0 spec/lib/appsignal/integrations/resque_active_job_spec.rb