remarkable-rb / remarkable

Simplifying tests!
http://www.nomedojogo.com/category/remarkable/
MIT License
120 stars 64 forks source link

Please, restore should_have_default_scope in rails-3.1 branch #35

Open maksar opened 12 years ago

maksar commented 12 years ago

Following code could be used to ensure, that default scope works as expected:

EmailLetter.scoped.to_sql.should == EmailLetter.unscoped.where(:sent => false, :error => false).to_sql

Usage would be:

it { should have_default_scope.where(:sent => false, :error => false) }

I'll provide pull request if needed.

hosh commented 12 years ago

If you can make it work and pass the specs I'll gladly accept a pull request. I cut them out somewhere in alpha1 or alpha2 because of the way the arel matching works did not work with default_scopes. The .to_sql conversion doesn't always work everywhere either, at least in the 3.0 series.