diff options
Diffstat (limited to 'spec/ruby/shared/hash/key_error.rb')
| -rw-r--r-- | spec/ruby/shared/hash/key_error.rb | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/spec/ruby/shared/hash/key_error.rb b/spec/ruby/shared/hash/key_error.rb index 061c88c483..0044cd5de2 100644 --- a/spec/ruby/shared/hash/key_error.rb +++ b/spec/ruby/shared/hash/key_error.rb @@ -2,24 +2,22 @@ describe :key_error, shared: true do it "raises a KeyError" do -> { @method.call(@object, 'foo') - }.should raise_error(KeyError) + }.should.raise(KeyError) end - ruby_version_is "2.5" do - it "sets the Hash as the receiver of KeyError" do - -> { - @method.call(@object, 'foo') - }.should raise_error(KeyError) { |err| - err.receiver.should equal(@object) - } - end + it "sets the Hash as the receiver of KeyError" do + -> { + @method.call(@object, 'foo') + }.should.raise(KeyError) { |err| + err.receiver.should.equal?(@object) + } + end - it "sets the unmatched key as the key of KeyError" do - -> { - @method.call(@object, 'foo') - }.should raise_error(KeyError) { |err| - err.key.to_s.should == 'foo' - } - end + it "sets the unmatched key as the key of KeyError" do + -> { + @method.call(@object, 'foo') + }.should.raise(KeyError) { |err| + err.key.to_s.should == 'foo' + } end end |
