added tests for show-input and \! commands

This commit is contained in:
John Mair 2011-06-03 21:55:23 +12:00
parent cef1d2f6c6
commit 9a245adb04
1 changed files with 22 additions and 0 deletions

View File

@ -20,6 +20,28 @@ describe "Pry::DefaultCommands::Input" do
end
end
describe "show-input" do
it 'should correctly show the current lines in the input buffer' do
str_output = StringIO.new
redirect_pry_io(InputTester.new("def hello", "puts :bing", "show-input", "exit-all"), str_output) do
pry
end
str_output.string.should =~ /\A\d+: def hello\n\d+: puts :bing/
end
end
describe "!" do
it 'should correctly clear the input buffer ' do
str_output = StringIO.new
redirect_pry_io(InputTester.new("def hello", "puts :bing", "!", "show-input", "exit-all"), str_output) do
pry
end
stripped_output = str_output.string.strip!
stripped_output.each_line.count.should == 1
stripped_output.should =~ /Input buffer cleared!/
end
end
describe "hist" do
push_first_hist_line = lambda do |hist, line|
hist.push line