Like suggested from the title, I've a strange mistake. In fact when i try to make an operation reserved to the test enviroment (for example: rake test:prepare), in some way it influence the other environments and delete all the record in my database (mysql). (I'm using rspec, and i'm following the tutorials from Michael Hartl.) Another example (maybe clearer) is when I write the tests that implicate the creation and the cancellation of new users throught FactoryGirl:
Location: spec/factories.rb
FactoryGirl.define do
factory :user do
sequence(:name) {|n| "Person #{n}"}
sequence(:email) {|n| "person_#{n}@example.it"}
password "luckyluke"
password_confirmation "luckyluke"
factory :admin do
admin true
end
end
Location: spec/requests/users_pages_spec.rb
describe "pagination" do
before(:all) { 30.times { FactoryGirl.create(:user) } }
after(:all) { User.delete_all }
# tests...
end
Although I'm into the test enviroment, when i run bundle exec rspec spec/requests/users_pages_spec.rb , rails really create 30 users on my database, and ater really delete ALL the users from database. (Also the users created and stored before the test!!).
P.S. sorry for my english