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