mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
alias clear as 'refresh'.
This commit is contained in:
parent
bdaf506061
commit
7e6f9e3ec3
3 changed files with 22 additions and 2 deletions
|
@ -78,10 +78,11 @@ module Pry::Config::Behavior
|
|||
@lookup.key?(key)
|
||||
end
|
||||
|
||||
def refresh
|
||||
def clear
|
||||
@lookup.clear
|
||||
true
|
||||
end
|
||||
alias_method :refresh, :clear
|
||||
|
||||
def forget(key)
|
||||
@lookup.delete(key.to_s)
|
||||
|
|
|
@ -124,6 +124,26 @@ describe Pry::Config do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#clear" do
|
||||
before do
|
||||
@local = Pry::Config.new(nil)
|
||||
end
|
||||
|
||||
it "returns true" do
|
||||
@local.clear.should == true
|
||||
end
|
||||
|
||||
it "clears local assignments" do
|
||||
@local.foo = 1
|
||||
@local.clear
|
||||
@local.to_hash.should == {}
|
||||
end
|
||||
|
||||
it "is aliased as #refresh" do
|
||||
@local.method(:clear).should == @local.method(:refresh)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#[]=" do
|
||||
it "stores keys as strings" do
|
||||
local = Pry::Config.from_hash({})
|
||||
|
|
|
@ -21,7 +21,6 @@ $VERBOSE = nil
|
|||
|
||||
Pad = Class.new do
|
||||
include Pry::Config::Behavior
|
||||
alias_method :clear, :refresh
|
||||
end.new(nil)
|
||||
|
||||
# to help with tracking down bugs that cause an infinite loop in the test suite
|
||||
|
|
Loading…
Add table
Reference in a new issue