Sha256: 936922ba04eba67479a5bc667cecce77ebf2d453f9d93c6947b34a3aad179ee3

Contents?: true

Size: 920 Bytes

Versions: 1

Compression:

Stored size: 920 Bytes

Contents

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

describe TestWorker do
  include FileHelper
  let(:message) do
    {
      title: "Cool",
      body: "Hot",
    }
  end

  before do
    @sneakers_worker = ExternalSneaker.new("rake sneakers:run", described_class)
    @sneakers_worker.start
    Sneakers.publish(
      message.to_json,
      to_queue: described_class::QUEUE_NAME,
      routing_key: described_class::ROUTING_KEY,
    )
  end

  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
    count = 0
    until File.exist?(described_class::VERIFICATION_FILE)
      sleep 0.1
      count += 1
      expect(true).to be(false) if count > 240
    end
    expect(true).to be(true)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sapience-1.0.4 test_apps/rails/spec/workers/test_worker_spec.rb