title: Is there a way to allow-list rspec tests that reach out to external domains?
body: <p>We have several React apps that are embedded in our platform's controllers, served from S3 AWS domains. By default, rspec seems to disallow having <code>&lt;script src=&quot;https://some-external-dns.com/scripts.js&quot;&gt;&lt;/script&gt;</code> in your code being tested, and instead asks that you &quot;stub&quot; your script request and response using something like this:</p>
  <pre class="lang-rb prettyprint-override"><code>stub_request(:get, &quot;https://foo-box.s3.amazonaws.com/assets/login-hero-manifest.json&quot;).with(
    headers: {
      'Accept' =&gt; '*/*',
       'Accept-Encoding' =&gt; 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
       'Host' =&gt; 'foo-box.s3.amazonaws.com',
      'User-Agent' =&gt; 'Ruby'
     }
  ).to_return(
    status: 200,
       body: {
      environment: &quot;prod&quot;,
         name: &quot;feature-administration&quot;,
        url: &quot;https://foo-box.s3.amazonaws.com/assets/login-hero.js&quot;
         }.to_json
  )
  </code></pre>
  <p>I get this in theory, but if we know this is a trusted domain, I would prefer us just resolve the response so we can test against it (also stubbing out hundreds of requests/responses across hundreds of tests feels completely unintuitive and unsustainable.</p>
  <p>I am not super well-versed in Ruby/rspec, but I was hoping there was some way to allow-list code that comes back from <code>foo-box.s3.amazonaws.com</code>.</p>