Skip to content

Commit

Permalink
(PUP-3030) confine uniquefile unlink tests
Browse files Browse the repository at this point in the history
Two of the new tests re: Uniquefile are not compatible with
windows.  (In the ruby source tree, they are skipped on windows.)

This commit confines them to only run on unix.
  • Loading branch information
cprice404 committed Aug 19, 2014
1 parent 58401f3 commit 1aaebcd
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions spec/unit/file_system/uniquefile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,18 @@ def tempfile(*args, &block)
expect(File.exist?(path)).to eq(false)
end

it "close doesn't unlink if already unlinked" do
t = tempfile("foo")
path = t.path
t.unlink
File.open(path, "w").close
begin
t.close(true)
expect(File.exist?(path)).to eq(true)
ensure
File.unlink(path) rescue nil
context "on unix platforms", :unless => Puppet.features.microsoft_windows? do
it "close doesn't unlink if already unlinked" do
t = tempfile("foo")
path = t.path
t.unlink
File.open(path, "w").close
begin
t.close(true)
expect(File.exist?(path)).to eq(true)
ensure
File.unlink(path) rescue nil
end
end
end

Expand All @@ -151,16 +153,18 @@ def tempfile(*args, &block)
expect(File.exist?(path)).to eq(false)
end

it "close! doesn't unlink if already unlinked" do
t = tempfile("foo")
path = t.path
t.unlink
File.open(path, "w").close
begin
t.close!
expect(File.exist?(path)).to eq(true)
ensure
File.unlink(path) rescue nil
context "on unix platforms", :unless => Puppet.features.microsoft_windows? do
it "close! doesn't unlink if already unlinked" do
t = tempfile("foo")
path = t.path
t.unlink
File.open(path, "w").close
begin
t.close!
expect(File.exist?(path)).to eq(true)
ensure
File.unlink(path) rescue nil
end
end
end

Expand Down

0 comments on commit 1aaebcd

Please sign in to comment.