Open terceiro opened 8 years ago
seems to be a rails issue: rails/rails@a98475c2df8ab7d7d353cb29bb3f201c4c7eb9d1
after I apply that patch to rails locally, it then fails with:
1) Error:
associations#test_0005_translates hash scope options into scopes:
ArgumentError: invalid value for Integer(): "c"
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/abstract/database_statements.rb:324:in `Integer'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/abstract/database_statements.rb:324:in `sanitize_limit'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/query_methods.rb:872:in `build_arel'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/query_methods.rb:858:in `arel'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/delegation.rb:119:in `respond_to?'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/spawn_methods.rb:43:in `merge!'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:158:in `block (2 levels) in add_constraints'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:154:in `each'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:154:in `block in add_constraints'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `each'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `each_with_index'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:141:in `add_constraints'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:39:in `scope'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association_scope.rb:5:in `scope'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association.rb:97:in `association_scope'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/association.rb:86:in `scope'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_association.rb:423:in `scope'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_proxy.rb:37:in `initialize'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/delegation.rb:106:in `new'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/relation/delegation.rb:106:in `create'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/collection_association.rb:39:in `reader'
/home/terceiro/.ruby-standalone/gems/ruby/2.3.0/gems/activerecord-4.2.5.2/lib/active_record/associations/builder/association.rb:115:in `comments'
/tmp/activerecord-deprecated_finders/test/associations_test.rb:49:in `block (2 levels) in <top (required)>'
and this is easy enough to fix:
diff --git a/test/associations_test.rb b/test/associations_test.rb
index aff9a07..50d9dea 100644
--- a/test/associations_test.rb
+++ b/test/associations_test.rb
@@ -42,7 +42,7 @@ describe 'associations' do
it 'translates hash scope options into scopes' do
assert_deprecated do
- @klass.has_many :comments, readonly: 'a', order: 'b', limit: 'c', group: 'd', having: 'e',
+ @klass.has_many :comments, readonly: 'a', order: 'b', limit: 1, group: 'd', having: 'e',
offset: 'f', select: 'g', uniq: 'h', include: 'i', conditions: 'j'
end
@@ -50,7 +50,7 @@ describe 'associations' do
scope.readonly_value.must_equal 'a'
scope.order_values.must_equal ['b']
- scope.limit_value.must_equal 'c'
+ scope.limit_value.must_equal 1
scope.group_values.must_equal ['d']
scope.having_values.must_equal ['e']
scope.offset_value.must_equal 'f'
and then it gives me:
# Running:
....................................................................
Finished in 0.356942s, 190.5073 runs/s, 392.2210 assertions/s.
What is the best way forward with this?
Hi,
I tried running the tests under Ruby 2.3 and they fail like this:
Also, I needed to do the following in order to run the tests at all, because with rails 5.0.0.beta3 the tests crashed during load: