0

When I run rake to run specific/all test(s), it corrupts development database.

I verified that db for each environment is different.

database.yml

postgre_common_config: &postgre_common_config
  adapter: postgresql
  encoding: unicode
  pool: 5
  username: postgres # if using default PostgreSQL user then the value should be: postgres
  password: postgres
  host: localhost

development:
  database: mag_development
  <<: *postgre_common_config

test:
  database: mag_test
  <<: *postgre_common_config

production:
  database: mag_production
  <<: *postgre_common_config

test_helper.rb

ENV['RAILS_ENV'] = 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

class ActiveSupport::TestCase
  fixtures :all
end

This is really annoying as it takes lot of time to prepare data to test specific feature manually. Please help.

Amit Patel
  • 15,609
  • 18
  • 68
  • 106
  • Did you created a ***DB*** with name `mag_test`? – Pavan Sep 09 '15 at 14:26
  • 2
    What do you mean by it corrupts the development database? Are you saying that when you run your tests, it leaves your test data in your development database? – Catherine Cai Sep 09 '15 at 14:46
  • Please post the rake command and all parameters you are using for this => "I run rake to run specific/all test(s)"...This is where to start. – Elvn Sep 09 '15 at 16:28
  • Corrupts development database means it removes rows from many tables especially relation tables. Which make stale data and of no use. I have to prepare test data again which take lot of time. – Amit Patel Sep 10 '15 at 02:46
  • Commands to run all tests `spring rake`, specific test `spring rake TEST=test/services/wordpress/new_post_test.rb` – Amit Patel Sep 10 '15 at 02:47
  • Okay. I don't use spring, so maybe someone who does will come in and help. Question: If you use standard $rake (without spring) does it cause the same problem to your database? – Elvn Sep 10 '15 at 13:49

0 Answers0