I have unit tests set up with "self.use_transactional_fixtures true", so each test should roll back. Run individually, all my tests succeed. But running "rake test:units", I get the below error in 5 test cases. I''m not sure how to solve this since I''m not sure how to debug tasks run thru rake. Any ideas are appreciated. 1) Error: test_delete(OrderTest): ActiveRecord::RecordInvalid: Validation failed: Orders is invalid /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ validations.rb:764:in `save_without _transactions!'' /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ transactions.rb:133:in `save!'' /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ connection_adapters/abstract/databa se_statements.rb:59:in `transaction'' /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ transactions.rb:95:in `transaction'' /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ transactions.rb:121:in `transaction '' /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ transactions.rb:133:in `save!'' ./test/unit/order_test.rb:13:in `test_delete'' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sep 1, 2007, at 8:51 PM, dailer wrote:> I have unit tests set up with "self.use_transactional_fixtures > true", so each test should roll back. > > Run individually, all my tests succeed. But running "rake > test:units", I get the below error in 5 test cases. I''m not sure how > to solve this since I''m not sure how to debug tasks run thru rake. Any > ideas are appreciated. > > 1) Error: > test_delete(OrderTest): > ActiveRecord::RecordInvalid: Validation failed: Orders is invalid > /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ > validations.rb:764:in `save_without > _transactions!'' > /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ > transactions.rb:133:in `save!'' > /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ > connection_adapters/abstract/databa > se_statements.rb:59:in `transaction'' > /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ > transactions.rb:95:in `transaction'' > /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ > transactions.rb:121:in `transaction > '' > /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ > transactions.rb:133:in `save!'' > ./test/unit/order_test.rb:13:in `test_delete''Area all of your database tables capable of supporting transactions? For example, if you are using MySQL, the MyISAM engine does not support transactions, but the InnoDB engine does. You can check with: mysql> show create table users\G *************************** 1. row *************************** Table: users Create Table: CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `username` varchar(255) default NULL, `hashed_password` varchar(255) default NULL, `email` varchar(255) default NULL, `created_at` datetime default NULL, `updated_at` datetime default NULL, ... PRIMARY KEY (`id`), UNIQUE KEY `users_username_index` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 1 row in set (0.00 sec) Notice the "ENGINE=InnoDB" at the end. If you are NOT using MySQL, then you probably need to supply more information about your environment. (For me, usually it''s the opposite problem, all tests run fine, but individually one doesn''t work and that tends to point to missing fixture declarations in the test that fails.) -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thx, but I''m using postgres. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sep 1, 9:58 pm, dailer <d.sai...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:> thx, but I''m using postgres.Check all of your fixtures lines. 99% of the time when this happens to me, that''s the cause. I''ve added some functionality that now uses a model that it never used before, and so I need to update the fixture statement - even if the tests in question don''t appear that they need those other fixtures. Barring that, you can try to run one file at a time: ruby test/unit/something_test.rb and see if at least the whole file can be run at once. That might also help narrow down the problem. Jeff softiesonrails.com essentialrails.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
like I said in my original post, they ALL run successfully when run individually. That''s what makes no sense about this, especially since I''m rolling back after each test. Also, I''m not using fixtures because I have fk constraints and found it hard to use fixtures. appreciate the input tho.... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---