test/unit/peddler/test_client.rb in peddler-1.6.3 vs test/unit/peddler/test_client.rb in peddler-1.6.4
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'helper'
require 'null_client'
class TestPeddlerClient < MiniTest::Test
def setup
@@ -130,16 +132,18 @@
end
def test_does_not_clear_body_when_run_fails
Excon.stub({}, status: 503)
@client.body = 'foo'
- assert_raises { @client.run }
+ assert_raises(Excon::Error::ServiceUnavailable) do
+ @client.run
+ end
refute_nil @client.body
end
def test_streams_response
chunks = ''
- streamer = ->(chunk, _, _) { chunks << chunk }
+ streamer = ->(chunk, _, _) { chunks += chunk }
@client.run(&streamer)
assert_equal @response_body, chunks
end