1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

History: increment @original_lines

Fix broken `Pry::History#session_line_count`. Add a test.
This commit is contained in:
Kyrylo Silin 2013-03-17 10:18:52 +02:00
parent 1d70d8627a
commit 6463387d07
2 changed files with 10 additions and 0 deletions

View file

@ -28,6 +28,7 @@ class Pry
@loader.call do |line|
@pusher.call(line.chomp)
@history << line.chomp
@original_lines += 1
end
end

View file

@ -17,6 +17,7 @@ describe Pry do
after do
Pry.history.clear
Pry.history.restore_default_behavior
Pry.history.instance_variable_set(:@original_lines, 0)
end
describe '#push' do
@ -34,6 +35,14 @@ describe Pry do
end
end
describe "#session_line_count" do
it "returns the number of lines in history from just this session" do
Pry.history << 'you?'
Pry.history << 'you are so precious'
Pry.history.session_line_count.should == 2
end
end
describe ".load_history" do
it "should read the contents of the file" do
Pry.history.to_a[-2..-1].should == %w(2 3)