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

Adding test for histignore functionality

This commit is contained in:
bronzdoc 2015-10-25 10:42:28 -06:00
parent ea7f6e50b4
commit 3caed67113
2 changed files with 32 additions and 0 deletions

View file

@ -196,5 +196,27 @@ describe "hist" do
expect(output).to match(/1:\s:athos\n2:\s:porthos\n3:\s:aramis\n/)
expect(output).to match(/4:\sgoodbye\n5:\sworld/)
end
it "should not display histignore words in history" do
Pry.config.history.histignore = [
"well",
"hello",
"beautiful",
/show*/,
"exit"
]
@hist.push("well")
@hist.push("hello")
@hist.push("beautiful")
@hist.push("why")
@hist.push("so")
@hist.push("serious?")
@hist.push("show-method")
@hist.push("exit")
output = @t.eval("hist")
expect(output).to match(/1:\swhy\n2:\sso\n3:\sserious\?\n/)
end
end
end

View file

@ -151,6 +151,16 @@ describe Pry do
expect(File.read(@histfile.path)).to eq "5\n6\n7\n"
end
it "should not write histignore words to the history file" do
Pry.config.history.histignore = [ "ls", /hist*/, 'exit' ]
@history.push "ls"
@history.push "hist"
@history.push "kakaroto"
@history.push "exit"
expect(File.open(@histfile.path).entries.size).to eq 1
end
end
describe "expanding the history file path" do