2014-04-27 13:15:29 -04:00
|
|
|
require_relative '../helper'
|
|
|
|
|
|
|
|
describe "reload_code" do
|
|
|
|
describe "reload_current_file" do
|
|
|
|
it 'raises an error source code not found' do
|
|
|
|
proc do
|
2014-05-07 03:59:36 -04:00
|
|
|
eval <<-RUBY, TOPLEVEL_BINDING, 'does_not_exist.rb', 1
|
|
|
|
pry_eval(binding, "reload-code")
|
|
|
|
RUBY
|
|
|
|
end.should.raise(Pry::CommandError)
|
2014-04-27 13:15:29 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'raises an error when class not found' do
|
|
|
|
proc do
|
|
|
|
pry_eval(
|
|
|
|
"cd Class.new(Class.new{ def goo; end; public :goo })",
|
|
|
|
"reload-code")
|
2014-05-07 03:59:36 -04:00
|
|
|
end.should.raise(Pry::CommandError)
|
2014-04-27 13:15:29 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|