From f4670b46c458cdc57eeee2fead2ffe811ea65096 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 19 Jan 2024 15:42:24 +0900 Subject: [PATCH] spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4"' spec/ruby/library/abbrev/**/*.rb --- spec/ruby/library/abbrev/abbrev_spec.rb | 47 +++++++++++++------------ 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/spec/ruby/library/abbrev/abbrev_spec.rb b/spec/ruby/library/abbrev/abbrev_spec.rb index 61b0926597..79045a0804 100644 --- a/spec/ruby/library/abbrev/abbrev_spec.rb +++ b/spec/ruby/library/abbrev/abbrev_spec.rb @@ -1,31 +1,34 @@ require_relative '../../spec_helper' -require 'abbrev' -#test both Abbrev.abbrev and Array#abbrev in -#the same manner, as they're more or less aliases -#of one another +ruby_version_is ""..."3.4" do + require 'abbrev' -[["Abbrev.abbrev", -> a { Abbrev.abbrev(a)}], - ["Array#abbrev", -> a { a.abbrev}] -].each do |(name, func)| + #test both Abbrev.abbrev and Array#abbrev in + #the same manner, as they're more or less aliases + #of one another - describe name do - it "returns a hash of all unambiguous abbreviations of the array of strings passed in" do - func.call(['ruby', 'rules']).should == {"rub" => "ruby", - "ruby" => "ruby", - "rul" => "rules", - "rule" => "rules", - "rules" => "rules"} + [["Abbrev.abbrev", -> a { Abbrev.abbrev(a)}], + ["Array#abbrev", -> a { a.abbrev}] + ].each do |(name, func)| - func.call(["car", "cone"]).should == {"ca" => "car", - "car" => "car", - "co" => "cone", - "con" => "cone", - "cone" => "cone"} - end + describe name do + it "returns a hash of all unambiguous abbreviations of the array of strings passed in" do + func.call(['ruby', 'rules']).should == {"rub" => "ruby", + "ruby" => "ruby", + "rul" => "rules", + "rule" => "rules", + "rules" => "rules"} - it "returns an empty hash when called on an empty array" do - func.call([]).should == {} + func.call(["car", "cone"]).should == {"ca" => "car", + "car" => "car", + "co" => "cone", + "con" => "cone", + "cone" => "cone"} + end + + it "returns an empty hash when called on an empty array" do + func.call([]).should == {} + end end end end