Sha256: 502a470e994d17c2d1ea37a4ea33aaa18e005e0e2d08e6a808e8d6655735c0ab

Contents?: true

Size: 887 Bytes

Versions: 3

Compression:

Stored size: 887 Bytes

Contents

require 'test/unit'
require 'inotify'

class Test1 < Test::Unit::TestCase
	def setup
		@inotify = Inotify.new
	end
	def test1
		assert_equal(Inotify, @inotify.class)
	end
	def test2
		assert(@inotify.add_watch("/tmp", Inotify::CREATE))
	end
	def test3
		wd = @inotify.add_watch("/tmp", Inotify::CREATE)
		assert_equal(Fixnum, wd.class)
		assert(@inotify.rm_watch(wd))
	end
	def test4
		@inotify.add_watch("/tmp", Inotify::CREATE)
		begin 
			File.open(File.join("/tmp", "ruby-inotify-test-4"), 'w')
			@inotify.each_event do |ev|
				assert_equal(ev.class, Inotify::Event)
				assert_equal(ev.inspect, "<Inotify::Event name=ruby-inotify-test-4 mask=256 wd=1>")
				assert_equal(ev.name, "ruby-inotify-test-4")
				assert_equal(ev.mask, Inotify::CREATE)
				break
			end
		ensure
			File.unlink(File.join("/tmp", "ruby-inotify-test-4"))
		end
	end
	def teardown
		@inotify.close
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-inotify-1.0.2 tests/test_1.rb
ruby-inotify-1.0.1 tests/test_1.rb
ruby-inotify-1.0.0 tests/test_1.rb