title: Test fail: object produced no output
body: <p>I am writing my first testsuite in R and I've come across something I don't quite understand. I've written a function which connects to an API and collects some data. I stored it as an S3 class.</p>
  <p>I want to write some tests to make sure my output was correct.</p>
  <p>Knowing that if I make a generic call to the API, I should get an expected output. However, I get an &quot;No output error&quot;.</p>
  <pre><code># IN test_api.R
  test_object &lt;- spacejam(&quot;2010-01-01&quot;, &quot;2010-12-31&quot;)
  
  test_that(&quot;Output is correct&quot;, {
    correct_df &lt;- data.frame(&quot;index&quot; = c(1:6), 
                             &quot;time&quot; = c(&quot;2010-06-13T16:42Z&quot;, &quot;2010-07-30T16:08Z&quot;, &quot;2010-08-01T08:10Z&quot;,
                                        &quot;2010-08-01T10:20Z&quot;, &quot;2010-08-01T11:20Z&quot;, &quot;2010-08-01T17:00Z&quot;),
                             &quot;speed&quot; = c(500, 750, 760, 1800, 1300, 550),
                             &quot;type&quot; = c(&quot;C&quot;, &quot;C&quot;, &quot;C&quot;, &quot;O&quot;, &quot;O&quot;, &quot;C&quot;))
    expect_output(head(test_object$data), correct_df)
  })
  </code></pre>
  <p>The error when running Test Package</p>
  <pre><code>Failure (test_api.R:33:3): Output is correct
  `head(test_object)` produced no output
  </code></pre>
  <p>What's produced it if I call <code>test_object</code>:</p>
  <pre><code>&gt; attributes(test_object)
  $names
  [1] &quot;data&quot;     &quot;response&quot;
  
  $class
  [1] &quot;spacejam_API&quot;
  
  &gt; head(test_object$data)
    index              time speed type
  1     1 2010-06-13T16:42Z   500    C
  2     2 2010-07-30T16:08Z   750    C
  3     3 2010-08-01T08:10Z   760    C
  4     4 2010-08-01T10:20Z  1800    O
  5     5 2010-08-01T11:20Z  1300    O
  6     6 2010-08-01T17:00Z   550    C
  </code></pre>
  <p>Why is this happening?</p>