diff options
Diffstat (limited to 'spec/ruby/core/hash/to_proc_spec.rb')
| -rw-r--r-- | spec/ruby/core/hash/to_proc_spec.rb | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/spec/ruby/core/hash/to_proc_spec.rb b/spec/ruby/core/hash/to_proc_spec.rb index 8f5d21beb5..bc4756600d 100644 --- a/spec/ruby/core/hash/to_proc_spec.rb +++ b/spec/ruby/core/hash/to_proc_spec.rb @@ -11,7 +11,7 @@ describe "Hash#to_proc" do end it "returns an instance of Proc" do - @hash.to_proc.should be_an_instance_of Proc + @hash.to_proc.should.instance_of? Proc end describe "the returned proc" do @@ -19,41 +19,33 @@ describe "Hash#to_proc" do @proc = @hash.to_proc end - ruby_version_is ""..."3.0" do - it "is not a lambda" do - @proc.should_not.lambda? - end + it "is a lambda" do + @proc.should.lambda? end - ruby_version_is "3.0" do - it "is a lambda" do - @proc.should.lambda? - end - - it "has an arity of 1" do - @proc.arity.should == 1 - end + it "has an arity of 1" do + @proc.arity.should == 1 end it "raises ArgumentError if not passed exactly one argument" do -> { @proc.call - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) -> { @proc.call 1, 2 - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end context "with a stored key" do it "returns the paired value" do - @proc.call(@key).should equal(@value) + @proc.call(@key).should.equal?(@value) end end context "passed as a block" do it "retrieves the hash's values" do - [@key].map(&@proc)[0].should equal(@value) + [@key].map(&@proc)[0].should.equal?(@value) end context "to instance_exec" do @@ -71,7 +63,7 @@ describe "Hash#to_proc" do context "with no stored key" do it "returns nil" do - @proc.call(@unstored).should be_nil + @proc.call(@unstored).should == nil end context "when the hash has a default value" do @@ -80,7 +72,7 @@ describe "Hash#to_proc" do end it "returns the default value" do - @proc.call(@unstored).should equal(@default) + @proc.call(@unstored).should.equal?(@default) end end @@ -93,7 +85,7 @@ describe "Hash#to_proc" do end it "raises an ArgumentError when calling #call on the Proc with no arguments" do - -> { @hash.to_proc.call }.should raise_error(ArgumentError) + -> { @hash.to_proc.call }.should.raise(ArgumentError) end end end |
