commit 332735b52720466ca8eb9e089cc42f128d54b644 Author: Lukas Oberhuber Date: Tue Dec 20 09:19:05 2011 +0000 Add advise function to File which is in ruby 1.9.3. As it is only a hint to the os in some cases, the function does nothing. diff --git a/lib/fakefs/file.rb b/lib/fakefs/file.rb index 5684ede..ebc3ff8 100644 --- a/lib/fakefs/file.rb +++ b/lib/fakefs/file.rb @@ -392,6 +392,11 @@ module FakeFS end end + if RUBY_VERSION >= "1.9.3" + def advise(advice, offset=0, len=0) + end + end + private def check_modes! diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index 0f34950..1d5bf7a 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -1861,4 +1861,14 @@ class FakeFSTest < Test::Unit::TestCase end end end + + if RUBY_VERSION >= "1.9.3" + def test_advise + File.open("foo", 'w') do |f| + assert_nothing_raised do + f.advise(:normal, 0, 0) + end + end + end + end end