Note that there are some explanatory texts on larger screens.

plurals
  1. POFactory Girl Saving to Development Database (Guard Issue)
    primarykey
    data
    text
    <p>I'm on <strong>Rails 3.2</strong> and have my gemfile set up like this:</p> <pre><code># Testing Gems gem "factory_girl_rails", :group =&gt; :test group :development, :test do gem "capybara" gem "rspec-rails" gem "guard-rspec" gem "ruby_gntp", :require =&gt; false gem "addressable" gem "launchy" end </code></pre> <p>However, Factory Girl <strong>insists</strong> on saving testing records to my development database rather than the testing database. <strong>Note that I am using guard to run the tests via the shell.</strong></p> <p>Here's what's in my database.yml:</p> <pre><code># SQLite version 3.x # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 pool: 5 timeout: 5000 </code></pre> <p>I know my question is similar to this one: <a href="https://stackoverflow.com/questions/7208358/factory-girl-saving-records-in-my-development-database">Factory girl saving records in my development database</a> but I'm doing everything he did and it still isn't working for me.</p> <p>I have also run <code>bundle update</code>, <code>bundle install</code>, <code>bundle install --without test</code> and then <code>bundle install</code> again. I originally thought it was a Gemfile.lock issue but everything I do to update that has no effect.</p> <p>Anyone have any ideas?</p> <h2>Update</h2> <p>All my factories are using the development.sqlite3 database, but here's an example:</p> <pre><code>FactoryGirl.define do factory :saddle, :class =&gt; Saddle do name "Carlton" saddle_category_id 2 description "This is a saddle description" details "Saddle details will go here!" best_uses "List of best uses should go here." price 3025.00 end end </code></pre> <p>The test code that saves to my database is simply <code>saddle = Factory(:saddle)</code>.</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.
 

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