Is there a reason to introduce the named scope `stock`? It's probably more expressive to show the call to `count`:

```ruby
assert_equal Hash.new, ac.engines.group(:id).count
```