I'm getting the following problem with my functional test.
mrbernz:mylife bernardleung$ ruby test/functional/forums_controller_test.rb .....
1) Error:
test_should_create_forum(ForumsControllerTest):
ActiveRecord::StatementInvalid: Mysql::BadFieldError: Unknown column 'id:3 name' in 'field list': INSERT INTO roles
(id
, id:3 name
) VALUES (707834473, 'Moderator')
A stack trace of the error points as follows...
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:158:in require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:265:in
require_or_load'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:224:in depend_on'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:136:in
require_dependency'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/fixtures.rb:853:in try_to_load_dependency'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/fixtures.rb:868:in
require_fixture_classes'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/fixtures.rb:865:in each'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/fixtures.rb:865:in
require_fixture_classes'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/fixtures.rb:848:in fixtures'
./test/functional/../test_helper.rb:35
test/functional/forums_controller_test.rb:1:in
require'
test/functional/forums_controller_test.rb:1
Unable to load roles_user, underlying cause no such file to load -- roles_user
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:158:in require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:265:in
require_or_load'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:224:in depend_on'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:136:in
require_dependency'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/fixtures.rb:853:in try_to_load_dependency'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/fixtures.rb:868:in
require_fixture_classes'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/fixtures.rb:865:in each'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/fixtures.rb:865:in
require_fixture_classes'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/fixtures.rb:848:in `fixtures'
test/functional/forums_controller_test.rb:4
My forums_controller_test.rb looks as follows (first few lines anyway)
require File.dirname(__FILE__) + '/../test_helper'
class ForumsControllerTest < ActionController::TestCase
fixtures :forums, :users, :roles, :roles_users
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:forums)
end
I don't understand why it's complaining about 'roles_user' as I don't ask for it anywhere, and what I do ask for or declare is 'roles_users' which is a table I do have!
mysql> show tables;
+-----------------------+
| Tables_in_mylife_test |
+-----------------------+
| articles |
| categories |
| forums |
| pages |
| posts |
| roles |
| roles_users |
| schema_migrations |
| topics |
| users |
+-----------------------+
10 rows in set (0.15 sec)
help?!
roles_user
? – zeteticmap.resources :role_user
– Jed Schneider