This project is archived and is in readonly mode.
missing model require statement in json serialization tests
Reported by Subba | August 6th, 2010 @ 02:10 PM | in 3.0.2
json_serialization_test is missing model require statement.
ruby -Itest
test/cases/serializeration/json_serialization_test.rb
Loaded suite test/cases/serializeration/json_serialization_test
Started
.......E Finished in 0.009671 seconds.
1) Error: (JsonSerializationTest): NameError: uninitialized
constant JsonSerializationTest::Automobile
test/cases/serializeration/json_serialization_test.rb:107:in `test_should_return_OrderedHash_for_errors'
/home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:67:in `__send__'
/home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:67:in `run'
/home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/callbacks.rb:408:in `_run_setup_callbacks'
/home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:65:in `run'
8 tests, 36 assertions, 0 failures, 1 errors
below patch fixes it
Comments and changes to this ticket
-
Rohit Arondekar August 7th, 2010 @ 05:04 AM
- State changed from new to open
- Importance changed from to Low
Whats happening here is that while running the entire test suite, using rake the test passes. It's validations_test.rb that requires 'models/automobile'. Added a caller.each { |c| puts c } inside Automobile and found the following on running the test suite —
/home/rohit/projects/rails/activemodel/test/models/automobile.rb:1:in `<top (required)>' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:219:in `require' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:219:in `block in require' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:205:in `block in load_dependency' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:578:in `new_constants_in' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:205:in `load_dependency' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:219:in `require' /home/rohit/projects/rails/activemodel/test/cases/validations_test.rb:7:in `<top (required)>' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:215:in `load' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:215:in `block in load' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:205:in `block in load_dependency' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:578:in `new_constants_in' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:205:in `load_dependency' /home/rohit/projects/rails/activesupport/lib/active_support/dependencies.rb:215:in `load' /home/rohit/.rvm/gems/ruby-1.9.2-rc1@rails-dev/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `block in <main>' /home/rohit/.rvm/gems/ruby-1.9.2-rc1@rails-dev/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each' /home/rohit/.rvm/gems/ruby-1.9.2-rc1@rails-dev/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `<main>'
+1 for finding this!
Also I found that the test that uses Automobile has some unnecessary whitespace.
Attached is a combined patch that adds the require(above patch) and removes the trailing whitespace.
-
Subba August 7th, 2010 @ 01:36 PM
i found one more test which has missing require statement.
rake test_sqlite3 TEST=test/cases/persistence_test.rb (in /home/ruby/Rails/rails3/automobile_rails/activerecord) /home/ruby/.rvm/rubies/ruby-1.8.7-p299/bin/ruby -w -I"lib:test:test/connections/native_sqlite3" "/home/ruby/.rvm/gems/ruby-1.8.7-p299@rails3/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/cases/persistence_test.rb" /home/ruby/.rvm/gems/ruby-1.8.7-p299@rails3/gems/bundler-1.0.0.rc.2/lib/bundler.rb:72: warning: instance variable @production not initialized Using native SQLite3 Loaded suite /home/ruby/.rvm/gems/ruby-1.8.7-p299@rails3/gems/rake-0.8.7/lib/rake/rake_test_loader Started ..................................F.............. Finished in 0.838698 seconds. 1) Failure: test_update_all_ignores_order_without_limit_from_association(PersistencesTest) [./test/cases/persistence_test.rb:26:in `test_update_all_ignores_order_without_limit_from_association' /home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:67:in `__send__' /home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:67:in `run' /home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/callbacks.rb:413:in `_run_setup_callbacks' /home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:65:in `run']: Exception raised: Class: <NameError> Message: <"uninitialized constant Post::Comment"> ---Backtrace--- /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/base.rb:1182:in `compute_type' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/reflection.rb:162:in `send' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/reflection.rb:162:in `klass' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/reflection.rb:198:in `quoted_table_name' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations/has_many_association.rb:102:in `construct_sql' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations/association_collection.rb:24:in `initialize' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations/has_many_association.rb:11:in `initialize' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations.rb:1492:in `new' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations.rb:1492:in `comments' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/association_preload.rb:237:in `send' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/association_preload.rb:237:in `preload_has_many_association' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/association_preload.rb:121:in `send' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/association_preload.rb:121:in `preload_one_association' /home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/ordered_hash.rb:135:in `each' /home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/ordered_hash.rb:135:in `each' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/association_preload.rb:115:in `preload_one_association' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/association_preload.rb:92:in `preload_associations' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/association_preload.rb:91:in `preload_associations' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/association_preload.rb:91:in `each' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/association_preload.rb:91:in `preload_associations' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/relation.rb:68:in `send' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/relation.rb:68:in `to_a' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/relation.rb:68:in `each' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/relation.rb:68:in `to_a' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/relation/finder_methods.rb:143:in `all' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations/association_collection.rb:70:in `find' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/base.rb:1119:in `with_scope' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations/association_proxy.rb:203:in `send' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations/association_proxy.rb:203:in `with_scope' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations/association_collection.rb:63:in `find' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations/association_collection.rb:467:in `find_target' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations/association_collection.rb:409:in `load_target' /home/ruby/Rails/rails3/automobile_rails/activerecord/lib/active_record/associations/association_collection.rb:312:in `length' ./test/cases/persistence_test.rb:27:in `test_update_all_ignores_order_without_limit_from_association' ./test/cases/persistence_test.rb:26:in `test_update_all_ignores_order_without_limit_from_association' /home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:67:in `__send__' /home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:67:in `run' /home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/callbacks.rb:413:in `_run_setup_callbacks' /home/ruby/Rails/rails3/automobile_rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:65:in `run' --------------- 49 tests, 137 assertions, 1 failures, 0 errors
i am updating patch with fix for this one also.
Rohit can you apply your patch on my new patch. -
Santiago Pastorino August 14th, 2010 @ 05:35 AM
- Milestone cleared.
The json_combined.diff patch doesn't apply cleanly, please rebase it
-
Santiago Pastorino August 14th, 2010 @ 10:41 AM
- State changed from open to committed
The patch had a wrong [#OMG] number
http://github.com/rails/rails/commit/b7fdc937fafb96134a484ee6866989...
http://github.com/rails/rails/commit/76c91a237c5cfa630b19c096c30f90...
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>
People watching this ticket
Attachments
Referenced by
- 5056 select tags do not check the :selected option properly can you reopen the ticket. commit mention is #5317 ticket...