Skip to content

Commit

Permalink
Added a spec for when a network exception occurs in ronin http.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Aug 12, 2024
1 parent bb94369 commit 4338d15
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/cli/commands/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,19 @@

expect(stdout.string).to eq(expected_response_body)
end

context "when a network exception occurs" do
let(:url) { "https://does.not.exist/" }
let(:error) do
"Failed to open TCP connection to does.not.exist:443 (getaddrinfo: Name or service not known)"
end

it "must print the URL and an error message to stderr" do
expect {
subject.process_value(url)
}.to output("#{subject.command_name}: #{url}: #{error}#{$/}").to_stderr
end
end
end

describe "#print_response" do
Expand Down

0 comments on commit 4338d15

Please sign in to comment.