Sha256: fd4fe4e3c20bba75c120582904b31126a07aa96af0b9a513441c9c751880e815

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'
require './lib/fusuma/custom_process'

module Fusuma
  RSpec.describe CustomProcess do
    class ForkTest
      include CustomProcess

      def call
        fork { puts 'hoge' }
      end
    end

    describe '.fork' do
      before do
        @test_instance = ForkTest.new
      end
      it 'call Process.fork and Process.setproctitle' do
        expect(Process).to receive(:fork).and_yield do |block_context|
          allow(block_context).to receive(:proctitle).and_return(@test_instance.proctitle)
          expect(Process).to receive(:setproctitle).with(@test_instance.proctitle)
        end
        @test_instance.call
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fusuma-2.4.1 spec/lib/custom_process_spec.rb