mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
add 'default' to the list of reserved keys & improve err msg.
This commit is contained in:
parent
9c3d2899eb
commit
98a418bec7
2 changed files with 3 additions and 3 deletions
|
@ -5,7 +5,7 @@ module Pry::Config::Behavior
|
|||
"[]", "[]=", "merge!",
|
||||
"respond_to?", "key?", "refresh",
|
||||
"forget", "inherited_by", "to_h",
|
||||
"to_hash", "_dup"
|
||||
"to_hash", "_dup", "default"
|
||||
].freeze
|
||||
|
||||
def self.included(klass)
|
||||
|
@ -39,7 +39,7 @@ module Pry::Config::Behavior
|
|||
def []=(key, value)
|
||||
key = key.to_s
|
||||
if RESERVED_KEYS.include?(key)
|
||||
raise ArgumentError, "sorry, '#{key}' is a reserved configuration key."
|
||||
raise ArgumentError, "few things are reserved by pry, but using '#{key}' as a configuration key is."
|
||||
end
|
||||
@writes[key] = value
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require_relative 'helper'
|
|||
describe Pry::Config do
|
||||
describe "reserved keys" do
|
||||
it "raises an ArgumentError on assignment of a reserved key" do
|
||||
local = Pry::Config.from_hash({})
|
||||
local = Pry::Config.new
|
||||
Pry::Config::RESERVED_KEYS.each do |key|
|
||||
should.raise(ArgumentError) { local[key] = 1 }
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue