diff --git a/lib/pry/history.rb b/lib/pry/history.rb index 539fec66..b8a71f5a 100644 --- a/lib/pry/history.rb +++ b/lib/pry/history.rb @@ -28,6 +28,7 @@ class Pry @loader.call do |line| @pusher.call(line.chomp) @history << line.chomp + @original_lines += 1 end end diff --git a/spec/history_spec.rb b/spec/history_spec.rb index 3d48483b..328a0a74 100644 --- a/spec/history_spec.rb +++ b/spec/history_spec.rb @@ -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)