summaryrefslogtreecommitdiff
path: root/spec/ruby/core/exception/key_error_spec.rb
blob: c5e2b1efbca2955baf07a1543276e70246a0eb1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require_relative '../../spec_helper'

describe "KeyError" do
  it "accepts :receiver and :key options" do
    receiver = mock("receiver")
    key = mock("key")

    error = KeyError.new(receiver: receiver, key: key)

    error.receiver.should == receiver
    error.key.should == key

    error = KeyError.new("message", receiver: receiver, key: key)

    error.message.should == "message"
    error.receiver.should == receiver
    error.key.should == key
  end
end