mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-17 04:34:24 +00:00
The spec for forking was hanging. This could be revisited after upgrading to mini_racer 0.6.1.
38 lines
704 B
Ruby
38 lines
704 B
Ruby
# frozen_string_literal: true
|
|
|
|
# We need to configure MiniRacer to allow forking.
|
|
# Otherwise this spec hangs on CI.
|
|
# https://github.com/rubyjs/mini_racer#fork-safety
|
|
require "mini_racer"
|
|
MiniRacer::Platform.set_flags!(:single_threaded)
|
|
|
|
require 'spec_helper'
|
|
|
|
class TestJob < ActiveJob::Base
|
|
def initialize
|
|
@file = Tempfile.new("test-job-result")
|
|
super
|
|
end
|
|
|
|
def perform(message)
|
|
@file.write(message)
|
|
end
|
|
|
|
def result
|
|
@file.rewind
|
|
@file.read
|
|
end
|
|
end
|
|
|
|
describe JobProcessor do
|
|
describe ".perform_forked" do
|
|
let(:job) { TestJob.new }
|
|
|
|
it "executes a job" do
|
|
JobProcessor.perform_forked(job, "hello")
|
|
|
|
expect(job.result).to eq "hello"
|
|
end
|
|
end
|
|
end
|