Unable to run the unit tests

5 views
Skip to first unread message

Nick Tidey

unread,
Sep 8, 2009, 2:55:26 AM9/8/09
to Rails SQLServer Adapter
Howdy folks

I'm getting an "uninitialized constant Author::Post (NameError)" error
trying to run the ODBC unit tests.

Rails version is 2.3.3.
Ruby is 1.8.7.

I get the same error with the adapter gem v2.2.19 and with a clone of
the current github master.

Cheers
Nick

Full stack trace below:

Nick@MacBook[~/Dev/aioi/art/vendor/plugins/adapters/sqlserver (master)]
$ rake sqlserver:test_sqlserver_odbc
(in /Users/Nick/Dev/aioi/art/vendor/plugins/adapters/sqlserver)
/opt/local/bin/ruby -I"lib:test:test/connections/
native_sqlserver_odbc:../../../rails/activerecord/test/" "/Users/
Nick/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/
cases/aaaa_create_tables_test_sqlserver.rb" "test/cases/
adapter_test_sqlserver.rb" "test/cases/
attribute_methods_test_sqlserver.rb" "test/cases/
basics_test_sqlserver.rb" "test/cases/calculations_test_sqlserver.rb"
"test/cases/column_test_sqlserver.rb" "test/cases/
connection_test_sqlserver.rb" "test/cases/
eager_association_test_sqlserver.rb" "test/cases/
execute_procedure_test_sqlserver.rb" "test/cases/
inheritance_test_sqlserver.rb" "test/cases/
method_scoping_test_sqlserver.rb" "test/cases/
migration_test_sqlserver.rb" "test/cases/
offset_and_limit_test_sqlserver.rb" "test/cases/
pessimistic_locking_test_sqlserver.rb" "test/cases/
query_cache_test_sqlserver.rb" "test/cases/
schema_dumper_test_sqlserver.rb" "test/cases/
specific_schema_test_sqlserver.rb" "test/cases/
table_name_test_sqlserver.rb" "test/cases/
transaction_test_sqlserver.rb" "test/cases/unicode_test_sqlserver.rb"
"../../../rails/activerecord/test/cases/aaa_create_tables_test.rb"
"../../../rails/activerecord/test/cases/adapter_test.rb" "../../../
rails/activerecord/test/cases/aggregations_test.rb" "../../../rails/
activerecord/test/cases/ar_schema_test.rb" "../../../rails/
activerecord/test/cases/associations/belongs_to_associations_test.rb"
"../../../rails/activerecord/test/cases/associations/
callbacks_test.rb" "../../../rails/activerecord/test/cases/
associations/cascaded_eager_loading_test.rb" "../../../rails/
activerecord/test/cases/associations/
eager_load_includes_full_sti_class_test.rb" "../../../rails/
activerecord/test/cases/associations/
eager_load_nested_include_test.rb" "../../../rails/activerecord/test/
cases/associations/eager_singularization_test.rb" "../../../rails/
activerecord/test/cases/associations/eager_test.rb" "../../../rails/
activerecord/test/cases/associations/extension_test.rb" "../../../
rails/activerecord/test/cases/associations/
has_and_belongs_to_many_associations_test.rb" "../../../rails/
activerecord/test/cases/associations/has_many_associations_test.rb"
"../../../rails/activerecord/test/cases/associations/
has_many_through_associations_test.rb" "../../../rails/activerecord/
test/cases/associations/has_one_associations_test.rb" "../../../rails/
activerecord/test/cases/associations/
has_one_through_associations_test.rb" "../../../rails/activerecord/
test/cases/associations/inner_join_association_test.rb" "../../../
rails/activerecord/test/cases/associations/join_model_test.rb"
"../../../rails/activerecord/test/cases/associations_test.rb"
"../../../rails/activerecord/test/cases/attribute_methods_test.rb"
"../../../rails/activerecord/test/cases/autosave_association_test.rb"
"../../../rails/activerecord/test/cases/base_test.rb" "../../../rails/
activerecord/test/cases/batches_test.rb" "../../../rails/activerecord/
test/cases/binary_test.rb" "../../../rails/activerecord/test/cases/
calculations_test.rb" "../../../rails/activerecord/test/cases/
callbacks_observers_test.rb" "../../../rails/activerecord/test/cases/
callbacks_test.rb" "../../../rails/activerecord/test/cases/
class_inheritable_attributes_test.rb" "../../../rails/activerecord/
test/cases/column_alias_test.rb" "../../../rails/activerecord/test/
cases/column_definition_test.rb" "../../../rails/activerecord/test/
cases/connection_pool_test.rb" "../../../rails/activerecord/test/cases/
database_statements_test.rb" "../../../rails/activerecord/test/cases/
date_time_test.rb" "../../../rails/activerecord/test/cases/
defaults_test.rb" "../../../rails/activerecord/test/cases/
deprecated_finder_test.rb" "../../../rails/activerecord/test/cases/
dirty_test.rb" "../../../rails/activerecord/test/cases/
finder_respond_to_test.rb" "../../../rails/activerecord/test/cases/
finder_test.rb" "../../../rails/activerecord/test/cases/
fixtures_test.rb" "../../../rails/activerecord/test/cases/
i18n_test.rb" "../../../rails/activerecord/test/cases/
inheritance_test.rb" "../../../rails/activerecord/test/cases/
invalid_date_test.rb" "../../../rails/activerecord/test/cases/
json_serialization_test.rb" "../../../rails/activerecord/test/cases/
lifecycle_test.rb" "../../../rails/activerecord/test/cases/
locking_test.rb" "../../../rails/activerecord/test/cases/
method_scoping_test.rb" "../../../rails/activerecord/test/cases/
migration_test.rb" "../../../rails/activerecord/test/cases/
mixin_test.rb" "../../../rails/activerecord/test/cases/
modules_test.rb" "../../../rails/activerecord/test/cases/
multiple_db_test.rb" "../../../rails/activerecord/test/cases/
named_scope_test.rb" "../../../rails/activerecord/test/cases/
nested_attributes_test.rb" "../../../rails/activerecord/test/cases/
pk_test.rb" "../../../rails/activerecord/test/cases/
pooled_connections_test.rb" "../../../rails/activerecord/test/cases/
query_cache_test.rb" "../../../rails/activerecord/test/cases/
readonly_test.rb" "../../../rails/activerecord/test/cases/
reflection_test.rb" "../../../rails/activerecord/test/cases/
reload_models_test.rb" "../../../rails/activerecord/test/cases/
sanitize_test.rb" "../../../rails/activerecord/test/cases/
schema_dumper_test.rb" "../../../rails/activerecord/test/cases/
serialization_test.rb" "../../../rails/activerecord/test/cases/
timestamp_test.rb" "../../../rails/activerecord/test/cases/
transactions_test.rb" "../../../rails/activerecord/test/cases/
unconnected_test.rb" "../../../rails/activerecord/test/cases/
validations_i18n_test.rb" "../../../rails/activerecord/test/cases/
validations_test.rb" "../../../rails/activerecord/test/cases/
xml_serialization_test.rb"
Using native SQLServer via ODBC
* DEFERRED: For abstract behavior with different language should do
a date insertion when language is german.
../../../rails/activerecord/test/cases/../../../activesupport/lib/
active_support/dependencies.rb:105:in `const_missing': uninitialized
constant Author::Post (NameError)
from ../../../rails/activerecord/test/cases/../../lib/active_record/
base.rb:2199:in `compute_type'
from ../../../rails/activerecord/test/cases/../../../activesupport/
lib/active_support/core_ext/kernel/reporting.rb:11:in
`silence_warnings'
from ../../../rails/activerecord/test/cases/../../lib/active_record/
base.rb:2195:in `compute_type'
from ../../../rails/activerecord/test/cases/../../lib/active_record/
reflection.rb:156:in `send'
from ../../../rails/activerecord/test/cases/../../lib/active_record/
reflection.rb:156:in `klass'
from ../../../rails/activerecord/test/cases/../../lib/active_record/
reflection.rb:187:in `quoted_table_name'
from ../../../rails/activerecord/test/cases/../../lib/active_record/
associations.rb:1381:in `configure_dependency_for_has_many'
from ../../../rails/activerecord/test/cases/../../lib/active_record/
associations.rb:795:in `has_many'
from (eval):3:in `has_many'
from ../../../rails/activerecord/test/models/author.rb:28
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `gem_original_require'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require'
from ../../../rails/activerecord/test/cases/../../../activesupport/
lib/active_support/dependencies.rb:156:in `require'
from ../../../rails/activerecord/test/cases/../../../activesupport/
lib/active_support/dependencies.rb:521:in `new_constants_in'
from ../../../rails/activerecord/test/cases/../../../activesupport/
lib/active_support/dependencies.rb:156:in `require'
from ./test/cases/eager_association_test_sqlserver.rb:2
from ../../../rails/activerecord/test/cases/../../../activesupport/
lib/active_support/dependencies.rb:145:in
`load_without_new_constant_marking'
from ../../../rails/activerecord/test/cases/../../../activesupport/
lib/active_support/dependencies.rb:145:in `load'
from ../../../rails/activerecord/test/cases/../../../activesupport/
lib/active_support/dependencies.rb:521:in `new_constants_in'
from ../../../rails/activerecord/test/cases/../../../activesupport/
lib/active_support/dependencies.rb:145:in `load'
from /Users/Nick/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/
rake_test_loader.rb:5
from /Users/Nick/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/
rake_test_loader.rb:5:in `each'
from /Users/Nick/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/
rake_test_loader.rb:5
rake aborted!
Command failed with status (1): [/opt/local/bin/ruby -I"lib:test:test/
conne...]

(See full trace by running task with --trace)

Ken Collins

unread,
Sep 8, 2009, 9:23:13 AM9/8/09
to rails-sqlse...@googlegroups.com

Is your checkout of rails that I am assuming is sym linked on "remotes/
origin/2-3-stable"?

- Ken

Nick Tidey

unread,
Sep 8, 2009, 6:30:20 PM9/8/09
to Rails SQLServer Adapter
I setup rails from gem and ran "rake rails:freeze:gems" to unpack
rails into vendor/ and then tried two things: unpacking and moving the
adapter gem into the required subdirectory and also cloning the
repository into that directory.

--
Nick

Nick Tidey

unread,
Sep 8, 2009, 6:46:34 PM9/8/09
to Rails SQLServer Adapter
Hi Ken,

Ok, further to that last post, I just tried checking out remotes/
origin/2-3-stable from github and running the unit tests of both the
v2.2.19 of the gem and the latest master against it and see the same
error.

--
Nick
> ...
>
> read more »

Nick Tidey

unread,
Sep 8, 2009, 9:47:17 PM9/8/09
to Rails SQLServer Adapter
Ok, I've got this working. Today, when searching on that error, I
found this rails ticket that escaped me yesterday:

https://rails.lighthouseapp.com/projects/8994/tickets/2550-fix-models-load-order-in-activerecords-tests

Adding "require 'models/post'" to the top of vendor/rails/
activerecords/test/models/author.rb allowed me to get the unit tests
running.

--
Nick
> ...
>
> read more »

Ken Collins

unread,
Sep 8, 2009, 10:19:19 PM9/8/09
to rails-sqlse...@googlegroups.com

Good find. I have to say that I've never seen that error when I'm
running the tests. It could be due to the fact that I'm using autotest
and not rake, odd. FYI, did you know there is an autotest specific
file for the adapter. The default mode is ODBC too, so all you have to
do is just "autotest".

- Ken

Nick Tidey

unread,
Sep 8, 2009, 10:30:58 PM9/8/09
to Rails SQLServer Adapter
I just saw that while checking out one of the other threads. Will give
it a shot.

--
Nick

On Sep 9, 12:19 pm, Ken Collins <k...@metaskills.net> wrote:
> Good find. I have to say that I've never seen that error when I'm  
> running the tests. It could be due to the fact that I'm using autotest  
> and not rake, odd. FYI, did you know there is an autotest specific  
> file for the adapter. The default mode is ODBC too, so all you have to  
> do is just "autotest".
>
>   - Ken
>
> On Sep 8, 2009, at 9:47 PM, Nick Tidey wrote:
>
>
>
>
>
> > Ok, I've got this working. Today, when searching on that error, I
> > found this rails ticket that escaped me yesterday:
>
> >https://rails.lighthouseapp.com/projects/8994/tickets/2550-fix-models...
> ...
>
> read more »

Nick Tidey

unread,
Sep 9, 2009, 12:08:04 AM9/9/09
to Rails SQLServer Adapter
Ken, just so you know, I got that same error given the following
commands:

gem install ZenTest
rails test_sql (using Rails 2.3.4 gem)
git clone git://github.com/rails/rails.git test_sql/vendor/rails
git clone git://github.com/rails-sqlserver/2000-2005-adapter.git
test_sql/vendor/plugins/adapters/sqlserver
cd test_sql/vendor/rails
git checkout remotes/origin/2-3-stable
[create databases and edit .../connections/native_sqlserver_odbc/
connection.rb as required]
cd ../plugins/adapters/sqlserver
autotest

Cheers
Nick
> ...
>
> read more »

Ken Collins

unread,
Sep 9, 2009, 8:49:31 AM9/9/09
to rails-sqlse...@googlegroups.com

Nick,

gem install ZenTest
rails test_sql (using Rails 2.3.4 gem)

Thats fine, the rails gem that generated the project is moot when it's finally vendored.

git clone git://github.com/rails/rails.git test_sql/vendor/rails
git clone git://github.com/rails-sqlserver/2000-2005-adapter.git test_sql/vendor/plugins/adapters/sqlserver
cd test_sql/vendor/rails
git checkout remotes/origin/2-3-stable

That looks good.

[create databases and edit .../connections/native_sqlserver_odbc/connection.rb as required]

I've never had to do this. I just use a DSN on my localhost that handles all the details. I could understand however if your remote server is not allowed to have blank password for the rails user, just FYI.

cd ../plugins/adapters/sqlserver
autotest

Yes, that looks good


 - Ken
Reply all
Reply to author
Forward
0 new messages