Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After doing some research, I have found that there isn't a way to do this. The test rake tasks will always drop the database, even when providing the <strong><code>TEST=</code></strong> option as Bohdan suggests.</p> <p>By using the <strong><code>--trace</code></strong> option, this can be proven. Here is the output:</p> <pre><code>$ rake test:units TEST=test/unit/post_test.rb --trace (in /Users/johnnyicon/Development/ror/test-app) ** Invoke test:units (first_time) ** Invoke test:prepare (first_time) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:abort_if_pending_migrations ** Execute db:test:prepare ** Invoke db:test:load (first_time) ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:load ** Invoke db:schema:load (first_time) ** Invoke environment ** Execute db:schema:load ** Execute test:prepare ** Execute test:units </code></pre> <p>Reading through the <a href="http://edgeguides.rubyonrails.org/testing.html#preparing-your-application-for-testing" rel="nofollow">Ruby on Rails Guides for Testing</a>, it describes what some of these rake tasks mean. The one to pay particular attention to is the <strong><code>db:test:load</code></strong> task, which you see on the 7th line from the bottom of the output as <strong><code>** Execute db:test:load</code></strong>. The guides say the following about this task: </p> <blockquote> <p>Recreate the test database from the current schema.rb</p> </blockquote> <p>So even if I were to execute the unit tests one by one as Bohdan suggests, the rake task would still recreate the database. Not the answer I was hoping for, but it isn't a problem anymore. </p> <p>The reason I was asking to begin with was because I did not have access to another database to use for testing, so I was using my development database for testing as well. But since then, I've been able to get another database dedicated for testing.</p> <p>Thanks anyway Bohdan! I appreciate the help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload