title: Errno::ECONNREFUSED: Failed to open TCP connection to localhost:4000
body: <p>I looked around and can't figure this error out.</p>
  
  <p>While running a spec I get this error right where the binding pry is <code>Errno::ECONNREFUSED: Failed to open TCP connection to localhost:3000</code>. Any ideas on how to fix it?</p>
  
  <p>When I run the development rails server the error goes away and the code runs.</p>
  
  <pre><code>    10: def call
   =&gt; 11:   binding.pry
      12:   image = MiniMagick::Image.open(url)
      13: end
  
  [1] pry(#&lt;ResizeImage&gt;)&gt; image = MiniMagick::Image.open(url)
  Errno::ECONNREFUSED: Failed to open TCP connection to localhost:3000 (Connection refused - connect(2) for "localhost" port 3000)
  from /Users/josephkonop/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/net/http.rb:939:in `rescue in block in connect'
  </code></pre>
  
  <p>Here is the code</p>
  
  <pre><code>class ResizeImage
    attr_reader :url, :width, :height
  
    def initialize(params)
      @url = params[:url]
      @width = params[:width]
      @height = params[:height]
    end
  
    def call
      binding.pry
      image = MiniMagick::Image.open(url)
    end
  end
  
  The spec:
  
  RSpec.describe 'Image Resizer', type: :request do
    describe '#create' do
      context 'when valid params' do
        let(:image_url) { ActionController::Base.helpers.asset_path("cat.jpg") }
        let(:width) { 300 }
        let(:height) { 200 }
  
        before do
          post "/api/v1/resize?url=#{image_url}&amp;width=#{width}&amp;height=#{height}"
        end
  
        it 'response' do
          expect(response.body).to eq('')
        end
      end
    end
  end
  
  Test.rb
  
  config.action_controller.asset_host = 'http://localhost:3000'
  </code></pre>