diff options
author | Benoit Daloze <eregontp@gmail.com> | 2023-02-27 21:02:44 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2023-02-27 21:02:44 +0100 |
commit | 18b4def471bb901d0baa4a1307185484cb05815f (patch) | |
tree | 779b24566144e9ee06c6f8de35bd2f7fd74ccdb4 /spec/ruby/core/file/open_spec.rb | |
parent | de60139053fa7c561858c5c5556d61c82f361dd9 (diff) |
Update to ruby/spec@e7dc804
Diffstat (limited to 'spec/ruby/core/file/open_spec.rb')
-rw-r--r-- | spec/ruby/core/file/open_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/ruby/core/file/open_spec.rb b/spec/ruby/core/file/open_spec.rb index 1729780570..0c6d6cd19c 100644 --- a/spec/ruby/core/file/open_spec.rb +++ b/spec/ruby/core/file/open_spec.rb @@ -565,6 +565,17 @@ describe "File.open" do File.open(@file, 'wb+') {|f| f.external_encoding.should == Encoding::BINARY} end + ruby_version_is "3.0" do + it "accepts options as a keyword argument" do + @fh = File.open(@file, 'w', 0755, flags: File::CREAT) + @fh.should be_an_instance_of(File) + + -> { + File.open(@file, 'w', 0755, {flags: File::CREAT}) + }.should raise_error(ArgumentError, "wrong number of arguments (given 4, expected 1..3)") + end + end + it "uses the second argument as an options Hash" do @fh = File.open(@file, mode: "r") @fh.should be_an_instance_of(File) |