Sha256: 6075356a02c8e61a251c11fca3dbf474c1a9d37f22826a788202c573f8483f91

Contents?: true

Size: 740 Bytes

Versions: 34

Compression:

Stored size: 740 Bytes

Contents

require_relative '../lib/rb-kqueue'
require 'tempfile'
require 'pathname'

RSpec.describe KQueue::Queue do
  describe '#watch_file' do
    let(:file_touched) { false }
    let(:queue) { KQueue::Queue.new }
    let(:file) { Tempfile.new 'rb-kqueue_test', Pathname(__dir__).parent.join('tmp') }

    context 'file is watched for writes' do
      before do
	queue.watch_file file.path, :write do
	  file_touched = !file_touched
	end
	queue.process
      end

      context 'file is written to' do
	it 'executes the defined block' do
	  expect { file.write 'test' }.to change { file_touched }.from(false).to true
	end
      end
    end

    context 'file is watched for reads' do
    end

    context 'file is not watched' do
    end
  end
end

Version data entries

34 entries across 27 versions & 3 rubygems

Version Path
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/rb-kqueue-0.2.5/spec/kqueue_queue_spec.rb