1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

Skip file rename tests on Windows on older Ruby versions

Since these platforms don't support the File::SHARE_DELETE flag on
files, Windows rejects any attempts to delete or rename a file opened
by us. There's nothing we can do here unfortunately...
This commit is contained in:
Holger Just 2019-09-17 22:25:04 +02:00
parent 8943e18aca
commit e3baeb377e

View File

@ -152,6 +152,16 @@ RSpec.describe Rackstash::Adapter::File do
end
it 'reopens the file if moved' do
# Moving / deleting an opened file on Windows is forbidden by default
# Since Ruby 2.3.0, we can set the FILE_SHARE_DELETE flag to allow this
# Earlier Ruby versions don't support this flag unfortunately.
if Gem.win_platform? && (
Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0') ||
RUBY_ENGINE == 'jruby'
)
skip "Platform doesn't support renaming opened files"
end
expect(adapter.auto_reopen?).to eql true
adapter.write('line1')
@ -173,6 +183,16 @@ RSpec.describe Rackstash::Adapter::File do
end
it 'does not reopen the logfile automatically' do
# Moving / deleting an opened file on Windows is forbidden by default
# Since Ruby 2.3.0, we can set the FILE_SHARE_DELETE flag to allow this
# Earlier Ruby versions don't support this flag unfortunately.
if Gem.win_platform? && (
Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0') ||
RUBY_ENGINE == 'jruby'
)
skip "Platform doesn't support renaming opened files"
end
expect(adapter.auto_reopen?).to eql false
adapter.write('line1')