From 999a13c2d8ff0b309e65ff289e4a1f9c47a54ef4 Mon Sep 17 00:00:00 2001 From: Kanezoh Date: Thu, 14 Oct 2021 11:23:11 +0900 Subject: [PATCH] make transact method private --- spec/agent_spec.cr | 12 +----------- src/mechanize.cr | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/spec/agent_spec.cr b/spec/agent_spec.cr index 86b7300..542e15e 100644 --- a/spec/agent_spec.cr +++ b/spec/agent_spec.cr @@ -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") diff --git a/src/mechanize.cr b/src/mechanize.cr index 829f7a7..6660bf7 100644 --- a/src/mechanize.cr +++ b/src/mechanize.cr @@ -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