justinfrench/formtastic — pull request #741 by rgarner (2011-11-11 12:38:21+00:00)
Title: Fix for #740

Pull request 545 tried to fix #740, but mocked the mongoid reviewer in a way that didn't accurately reflect how Mongoid really behaves (it doesn't return `nil` for `reflection[:options]`, it throws a `NoMethodError`). In addition, it masked a successive problem where a call to `.scoped(:conditions => nil)` for a model would always return empty results.

I've got a test in for the first part, but I have to admit to being a little stumped how I'd mock `scoped` properly to show I've dealt with the second. All specs still pass but really a spec is required that shows that `scoped` shouldn't ever be called with `:conditions => nil`. I'm afraid `spec_helper` rather got the better of me here in the hour I'd allocated to try and help out ;)