test/test_expectr.rb in expectr-0.5.1 vs test/test_expectr.rb in expectr-0.7.0
- old
+ new
@@ -56,6 +56,20 @@
].each {|x| x.join}
assert_not_nil exp.expect /321/
end
end
+
+ def test_create_with_file
+ assert_nothing_raised { exp = Expectr.new File.new("/bin/ls"), :flush_buffer => false }
+ end
+
+ def test_executable
+ assert_nothing_raised { exp = Expectr.new "/bin/ls", :flush_buffer => false }
+
+ # Ruby 1.8's PTY allows execution of non-executable/nonexistent files without complaint
+ unless RUBY_VERSION =~ /1.8/
+ assert_raises(Errno::ENOENT) { exp = Expectr.new "/bin/ThisFileShouldNotExist", :flush_buffer => false }
+ assert_raises(Errno::EACCES) { exp = Expectr.new "lib/expectr.rb", :flush_buffer => false }
+ end
+ end
end