[前][次][番号順一覧][スレッド一覧]

ruby-changes:59816

From: Nobuyoshi <ko1@a...>
Date: Mon, 27 Jan 2020 10:19:55 +0900 (JST)
Subject: [ruby-changes:59816] 9b55a9649f (master): Removed useless "spec"s

https://git.ruby-lang.org/ruby.git/commit/?id=9b55a9649f

From 9b55a9649fb1973180559a067cfee0d6f234fef8 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 27 Jan 2020 10:10:58 +0900
Subject: Removed useless "spec"s

It is not specific to particular methods that keyword option
arguments are coerced to `Hash`es using `to_hash` method.

diff --git a/spec/ruby/core/array/sample_spec.rb b/spec/ruby/core/array/sample_spec.rb
index 87f8199..73b6bdf 100644
--- a/spec/ruby/core/array/sample_spec.rb
+++ b/spec/ruby/core/array/sample_spec.rb
@@ -65,26 +65,6 @@ describe "Array#sample" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/sample_spec.rb#L65
   end
 
   describe "with options" do
-    ruby_version_is ""..."2.8" do
-      # keyword argument since 2.8
-      it "calls #to_hash to convert the passed Object" do
-        obj = mock("array_sample")
-        obj.should_receive(:to_hash).and_return({})
-        obj.should_not_receive(:to_int)
-
-        [1, 2].sample(obj).should be_an_instance_of(Fixnum)
-      end
-
-      it "calls #to_int on the first argument and #to_hash on the second when passed Objects" do
-        count = mock("array_sample_count")
-        count.should_receive(:to_int).and_return(2)
-        options = mock("array_sample_options")
-        options.should_receive(:to_hash).and_return({})
-
-        [1, 2].sample(count, options).size.should == 2
-      end
-    end
-
     it "calls #rand on the Object passed by the :random key in the arguments Hash" do
       obj = mock("array_sample_random")
       obj.should_receive(:rand).and_return(0.5)
diff --git a/spec/ruby/core/array/shuffle_spec.rb b/spec/ruby/core/array/shuffle_spec.rb
index 106ef05..857062c 100644
--- a/spec/ruby/core/array/shuffle_spec.rb
+++ b/spec/ruby/core/array/shuffle_spec.rb
@@ -25,15 +25,6 @@ describe "Array#shuffle" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/array/shuffle_spec.rb#L25
     ArraySpecs::MyArray[1, 2, 3].shuffle.should be_an_instance_of(Array)
   end
 
-  ruby_version_is ""..."2.8" do
-    # keyword argument since 2.8
-    it "attempts coercion via #to_hash" do
-      obj = mock('hash')
-      obj.should_receive(:to_hash).once.and_return({})
-      [2, 3].shuffle(obj)
-    end
-  end
-
   it "calls #rand on the Object passed by the :random key in the arguments Hash" do
     obj = mock("array_shuffle_random")
     obj.should_receive(:rand).at_least(1).times.and_return(0.5)
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]