diff options
Diffstat (limited to 'spec/ruby/core/file/open_spec.rb')
-rw-r--r-- | spec/ruby/core/file/open_spec.rb | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/spec/ruby/core/file/open_spec.rb b/spec/ruby/core/file/open_spec.rb index 8faa31173e..c7dd34d5c6 100644 --- a/spec/ruby/core/file/open_spec.rb +++ b/spec/ruby/core/file/open_spec.rb @@ -629,31 +629,29 @@ describe "File.open" do }.should raise_error(ArgumentError, "newline decorator with binary mode") end - ruby_version_is "2.6" do - context "'x' flag" do - before :each do - @xfile = tmp("x-flag") - rm_r @xfile - end + context "'x' flag" do + before :each do + @xfile = tmp("x-flag") + rm_r @xfile + end - after :each do - rm_r @xfile - end + after :each do + rm_r @xfile + end - it "does nothing if the file doesn't exist" do - File.open(@xfile, "wx") { |f| f.write("content") } - File.read(@xfile).should == "content" - end + it "does nothing if the file doesn't exist" do + File.open(@xfile, "wx") { |f| f.write("content") } + File.read(@xfile).should == "content" + end - it "throws a Errno::EEXIST error if the file exists" do - touch @xfile - -> { File.open(@xfile, "wx") }.should raise_error(Errno::EEXIST) - end + it "throws a Errno::EEXIST error if the file exists" do + touch @xfile + -> { File.open(@xfile, "wx") }.should raise_error(Errno::EEXIST) + end - it "can't be used with 'r' and 'a' flags" do - -> { File.open(@xfile, "rx") }.should raise_error(ArgumentError, 'invalid access mode rx') - -> { File.open(@xfile, "ax") }.should raise_error(ArgumentError, 'invalid access mode ax') - end + it "can't be used with 'r' and 'a' flags" do + -> { File.open(@xfile, "rx") }.should raise_error(ArgumentError, 'invalid access mode rx') + -> { File.open(@xfile, "ax") }.should raise_error(ArgumentError, 'invalid access mode ax') end end end |