views:

25

answers:

1

Hi,

I'm having issues when running the default tests in Rails3 beta4 with Cancan (http://github.com/ryanb/cancan). The tests are the plain vanilla auto-generated ones that look like

test "the truth" do assert true end

Every single test (both unit and functional) yields the following error :

ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: abilities: DELETE FROM "abilities" WHERE 1=1

This happens even if a use and ability are defined in test_helpers.rb

I assume this is due to the Ability model Cancan uses for authorization as it isn't persisted (just a plain Ruby class) and therefore has no table in the DB. Perhaps something is trying to tear down abilities after tests and mistakenly trying to delete abilities from the database? How can I check this (and more importantly, fix)?

Once again, there is no custom logic in the tests: they are as generated by Rails3 beta4.

(FYI the Ability class does not inherit from ActiveRecord::Base and includes CanCan::Ability. Also, the app--authorization and all--works fine.)

Environment: - ruby 1.8.7-p249 - rails 3.0.0.beta4 - cancan 1.2.0 - devise 1.1.rc2

Anybody else run into this issue ?

Thanks for your help !

UPDATE: tried switching to PostgreSQL. Evidently, error is DB-independent: got the following error when running "rake test"

ActiveRecord::StatementInvalid: PGError: ERROR: relation "abilities" does not exist LINE 1: DELETE FROM "abilities" ^ : DELETE FROM "abilities"

A: 

Problem solved: I had an abilities.yml fixture file. After deleting it, the error is gone.

http://github.com/ryanb/cancan/issues/closed#issue/109

David Sulc