fix (most of) sticky_local_spec.rb.
This commit is contained in:
parent
ef53b2f2c5
commit
71251c5e7f
|
@ -153,7 +153,7 @@ class Pry
|
|||
# @yield The block that defines the content of the local. The local
|
||||
# will be refreshed at each tick of the repl loop.
|
||||
def add_sticky_local(name, &block)
|
||||
sticky_locals[name] = block
|
||||
config.extra_sticky_locals[name] = block
|
||||
end
|
||||
|
||||
def sticky_locals
|
||||
|
@ -165,7 +165,7 @@ class Pry
|
|||
_dir_: last_dir,
|
||||
_: last_result,
|
||||
__: output_array[-2]
|
||||
}
|
||||
}.merge(config.extra_sticky_locals)
|
||||
end
|
||||
|
||||
# Reset the current eval string. If the user has entered part of a multiline
|
||||
|
|
|
@ -44,13 +44,11 @@ describe "Sticky locals (_file_ and friends)" do
|
|||
describe "setting as Pry.config option" do
|
||||
it 'should define a new sticky local for the session (normal value)' do
|
||||
Pry.config.extra_sticky_locals[:test_local] = :john
|
||||
|
||||
o = Object.new
|
||||
redirect_pry_io(InputTester.new("@value = test_local",
|
||||
"exit-all")) do
|
||||
Pry.start(o)
|
||||
end
|
||||
|
||||
o.instance_variable_get(:@value).should == :john
|
||||
Pry.config.extra_sticky_locals = {}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue