This project is archived and is in readonly mode.
Tests and model not based on activerecord
Reported by Matija Folnovic | January 15th, 2010 @ 04:35 PM
Hello!
I have unit test for controller Players, and in it, I
have:
test "encrypting password" do
assert true
end
I also have a model map which isn't based on activerecord (
tableless ), and when I run tests, I get these errors for each
test:
1) Error: test_encrypting_password(PlayerTest): ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: maps: DELETE FROM "maps" WHERE 1=1 /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/abstract_adapter.rb:206:in
rescue in log' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/abstract_adapter.rb:196:inlog' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/sqlite_adapter.rb:150:inblock in execute' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/sqlite_adapter.rb:390:in
catch_schema_changes' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/sqlite_adapter.rb:150:inexecute' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/abstract/database_statements.rb:226:in
update_sql' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/sqlite_adapter.rb:154:inupdate_sql' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/abstract/database_statements.rb:231:in
delete_sql' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/sqlite_adapter.rb:160:indelete_sql' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/abstract/database_statements.rb:54:in
delete' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/abstract/query_cache.rb:25:indelete_with_query_dirty' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/fixtures.rb:549:in
delete_existing_fixtures' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/fixtures.rb:511:inblock (4 levels) in create_fixtures' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/fixtures.rb:511:in
each' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/fixtures.rb:511:inblock (3 levels) in create_fixtures' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in
transaction' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/fixtures.rb:510:inblock (2 levels) in create_fixtures' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/connection_adapters/abstract_adapter.rb:107:in
disable_referential_integrity' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/fixtures.rb:501:inblock in create_fixtures' /var/lib/gems/1.9.1/gems/activesupport-3.0.pre/lib/active_support/benchmarkable.rb:55:in
silence' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/fixtures.rb:500:increate_fixtures' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/fixtures.rb:961:in
load_fixtures' /var/lib/gems/1.9.1/gems/activerecord-3.0.pre/lib/active_record/fixtures.rb:926:insetup_fixtures' /var/lib/gems/1.9.1/gems/activesupport-3.0.pre/lib/active_support/callbacks.rb:428:in
_run_setup_callbacks' /var/lib/gems/1.9.1/gems/activesupport-3.0.pre/lib/active_support/testing/setup_and_teardown.rb:31:inrun'</code> </pre>
It seems after test, it's trying to delete everything from each model table, but seems it isn't checking if it's based on activerecord...
Tnx in advance!
Comments and changes to this ticket
-
Mark Foster April 12th, 2010 @ 10:07 PM
I suspect you are getting this because in test_helper.rb you have the fixtures setting:
fixtures :all
Comment that out and specify individual fixtures for your AR models and your error should go away.
-
Rohit Arondekar June 15th, 2010 @ 02:01 PM
- State changed from new to invalid
I'm closing this ticket as Mark's advice seems spot on. If the issue still exists, feel free to make a comment asking for ticket to be re-opened and I'll do it.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>