diff options
Diffstat (limited to 'spec/ruby/library/getoptlong')
| -rw-r--r-- | spec/ruby/library/getoptlong/error_message_spec.rb | 2 | ||||
| -rw-r--r-- | spec/ruby/library/getoptlong/ordering_spec.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/library/getoptlong/set_options_spec.rb | 14 | ||||
| -rw-r--r-- | spec/ruby/library/getoptlong/shared/get.rb | 12 | ||||
| -rw-r--r-- | spec/ruby/library/getoptlong/terminated_spec.rb | 6 |
5 files changed, 18 insertions, 20 deletions
diff --git a/spec/ruby/library/getoptlong/error_message_spec.rb b/spec/ruby/library/getoptlong/error_message_spec.rb index 1ed9419f6c..10435b1350 100644 --- a/spec/ruby/library/getoptlong/error_message_spec.rb +++ b/spec/ruby/library/getoptlong/error_message_spec.rb @@ -14,7 +14,7 @@ describe "GetoptLong#error_message" do opts.get -> { opts.ordering = GetoptLong::PERMUTE - }.should raise_error(ArgumentError) { |e| + }.should.raise(ArgumentError) { |e| e.message.should == "argument error" opts.error_message.should == "argument error" } diff --git a/spec/ruby/library/getoptlong/ordering_spec.rb b/spec/ruby/library/getoptlong/ordering_spec.rb index 695d1cafa7..60ce73afaa 100644 --- a/spec/ruby/library/getoptlong/ordering_spec.rb +++ b/spec/ruby/library/getoptlong/ordering_spec.rb @@ -11,7 +11,7 @@ describe "GetoptLong#ordering=" do -> { opts.ordering = GetoptLong::PERMUTE - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end end @@ -20,7 +20,7 @@ describe "GetoptLong#ordering=" do -> { opts.ordering = 12345 - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end it "does not allow changing ordering to PERMUTE if ENV['POSIXLY_CORRECT'] is set" do diff --git a/spec/ruby/library/getoptlong/set_options_spec.rb b/spec/ruby/library/getoptlong/set_options_spec.rb index 36b9c579c4..f60dcc87a3 100644 --- a/spec/ruby/library/getoptlong/set_options_spec.rb +++ b/spec/ruby/library/getoptlong/set_options_spec.rb @@ -41,7 +41,7 @@ describe "GetoptLong#set_options" do argv [] do -> { @opts.set_options(["--size", GetoptLong::NO_ARGUMENT, GetoptLong::REQUIRED_ARGUMENT]) - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end end @@ -50,7 +50,7 @@ describe "GetoptLong#set_options" do @opts.get -> { @opts.set_options() - }.should raise_error(RuntimeError) + }.should.raise(RuntimeError) end end @@ -58,7 +58,7 @@ describe "GetoptLong#set_options" do argv [] do -> { @opts.set_options(["--size"]) - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end end @@ -68,7 +68,7 @@ describe "GetoptLong#set_options" do @opts.set_options( ["--size", GetoptLong::REQUIRED_ARGUMENT], "test") - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end end @@ -78,13 +78,13 @@ describe "GetoptLong#set_options" do @opts.set_options( ["--size", GetoptLong::NO_ARGUMENT], ["--size", GetoptLong::OPTIONAL_ARGUMENT]) - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) -> { @opts.set_options( ["--size", GetoptLong::NO_ARGUMENT], ["-s", "--size", GetoptLong::OPTIONAL_ARGUMENT]) - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end end @@ -92,7 +92,7 @@ describe "GetoptLong#set_options" do argv [] do -> { @opts.set_options(["-size", GetoptLong::NO_ARGUMENT]) - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end end end diff --git a/spec/ruby/library/getoptlong/shared/get.rb b/spec/ruby/library/getoptlong/shared/get.rb index 772a7f6773..8d24c4c255 100644 --- a/spec/ruby/library/getoptlong/shared/get.rb +++ b/spec/ruby/library/getoptlong/shared/get.rb @@ -49,16 +49,14 @@ describe :getoptlong_get, shared: true do it "raises a if an argument was required, but none given" do argv [ "--size" ] do - -> { @opts.send(@method) }.should raise_error(GetoptLong::MissingArgument) + -> { @opts.send(@method) }.should.raise(GetoptLong::MissingArgument) end end - ruby_version_is "2.5" do - # https://bugs.ruby-lang.org/issues/13858 - it "returns multiline argument" do - argv [ "--size=\n10k\n" ] do - @opts.send(@method).should == [ "--size", "\n10k\n" ] - end + # https://bugs.ruby-lang.org/issues/13858 + it "returns multiline argument" do + argv [ "--size=\n10k\n" ] do + @opts.send(@method).should == [ "--size", "\n10k\n" ] end end end diff --git a/spec/ruby/library/getoptlong/terminated_spec.rb b/spec/ruby/library/getoptlong/terminated_spec.rb index 01a8feddea..6108a7f6e9 100644 --- a/spec/ruby/library/getoptlong/terminated_spec.rb +++ b/spec/ruby/library/getoptlong/terminated_spec.rb @@ -5,13 +5,13 @@ describe "GetoptLong#terminated?" do it "returns true if option processing has terminated" do argv [ "--size", "10k" ] do opts = GetoptLong.new(["--size", GetoptLong::REQUIRED_ARGUMENT]) - opts.terminated?.should == false + opts.should_not.terminated? opts.get.should == ["--size", "10k"] - opts.terminated?.should == false + opts.should_not.terminated? opts.get.should == nil - opts.terminated?.should == true + opts.should.terminated? end end end |
