Sha256: 04f9c3601217367fe9674df808ea57023db86e485d168f8a4b69446f3f23f473

Contents?: true

Size: 888 Bytes

Versions: 8

Compression:

Stored size: 888 Bytes

Contents

require "rails_helper"
require "serverengine"
require "sneakers"
require "sneakers/runner"
require "external_sneaker"

describe TestJob do
  include FileHelper
  include ActiveJob::TestHelper
  let(:metrics) { Sapience.add_appender(:datadog) }
  let(:tags) do
    %w(name:test queue:test_queue)
  end
  let(:message) do
    {
      title: "Cool",
      body: "Hot",
    }
  end
  let(:logger) { Sapience[described_class] }

  after do
    delete_file("config/sapience.yml")
    delete_file(described_class::VERIFICATION_FILE)
  end

  # TODO: Possible make this less flaky or run it with retry (rspec-retry)
  it "runs properly" do
    expect(metrics).to receive(:increment).with("activejob.perform", tags: tags)
    expect(metrics).to receive(:timing).with("activejob.perform.time", kind_of(Float), tags: tags)

    perform_enqueued_jobs do
      TestJob.perform_later
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sapience-1.0.11 test_apps/rails/spec/jobs/test_job_spec.rb
sapience-1.0.10 test_apps/rails/spec/jobs/test_job_spec.rb
sapience-1.0.9 test_apps/rails/spec/jobs/test_job_spec.rb
sapience-1.0.8 test_apps/rails/spec/jobs/test_job_spec.rb
sapience-1.0.7 test_apps/rails/spec/jobs/test_job_spec.rb
sapience-1.0.6 test_apps/rails/spec/jobs/test_job_spec.rb
sapience-1.0.5 test_apps/rails/spec/jobs/test_job_spec.rb
sapience-1.0.4 test_apps/rails/spec/jobs/test_job_spec.rb