I have heaps of this's:
validates_uniqueness_of :name, :if => :name_changed?
(to keep the nr of db queries to a minimum)
However, at the moment this cannot be tested with a one liner using
remarkable.
I was wondering, shouldn't we allow e.g. :
it { should validate_uniqueness_of(:name).if(:name_changed?) }
In essence, allow the :if and :unless if the argument is a symbol.
In this example I've given, the name_changed? method is implemented by
ActiveRecord, so I don't need further testing for that. But suppose you
had :if => :my_extra_validation, then you could add a specific test for
that method only.
Cheers,
Lawrence