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:
parent
1d70d8627a
commit
6463387d07
2 changed files with 10 additions and 0 deletions
|
@ -28,6 +28,7 @@ class Pry
|
|||
@loader.call do |line|
|
||||
@pusher.call(line.chomp)
|
||||
@history << line.chomp
|
||||
@original_lines += 1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue