make transact method private

master
Kanezoh 2021-10-14 11:23:11 +09:00
parent 289b79c3d5
commit 999a13c2d8
2 changed files with 2 additions and 12 deletions

View File

@ -57,17 +57,7 @@ describe "Mechanize Agent test" do
agent2.history.pop.uri.to_s.should eq "http://example.com/form"
end
it "doesn't add page to history within transact block" do
agent = Mechanize.new
agent.get("http://example.com/")
agent.history.size.should eq 1
agent.transact do
agent.get("http://example.com/")
end
agent.history.size.should eq 1
end
it "can download page" do
it "can download page, and it isn't recorded in history." do
agent = Mechanize.new
agent.history.size.should eq 0
agent.download("http://example.com", "mechanizecr_example.html")

View File

@ -221,7 +221,7 @@ class Mechanize
end
# Runs given block, then resets the page history as it was before.
def transact
private def transact
# save the previous history status.
history_backup = MechanizeCr::History.new(@agent.history.max_size, @agent.history.array.dup)
begin