rails/rails — pull request #8127 by nikitug (2012-11-06 08:16:00+00:00)
Title: Fix #8080 (wrong #respond_to? value for AR::Delegation).

Fix the case when `Relation#respond_to?` always return `true` for the methods delegated to `@klass` without checking for this method in `@klass`.

Before patch:

```ruby
Topic.all.by_lifo #=> Creates the scoped method on ActiveRecord::Delegation module
Post.all.respond_to?(:by_lifo) #=> true
Post.all.by_lifo #=> NoMethodError
```

After patch:
```ruby
Topic.all.by_lifo #=> Creates the scoped method on ActiveRecord::Delegation module
Post.all.respond_to?(:by_lifo) #=> false
```

Also moved delegation tests to the separate case and fixed some hashes to 1.9-style.