search for: find_older_than

Displaying 1 result from an estimated 1 matches for "find_older_than".

2007 Feb 22
7
We can''t 100% remove our unit tests from the database, can we?
...s sort of a brain dump of a subject I''ve been thinking about for months as I''ve used RSpec. Let''s say we''ve got a simple query method, that will find all the users in the DB older than 18. Our model could look like class User < ActiveRecord::Base def self.find_older_than(age) find :all, :conditions => ["age > ?", age] end end What would our spec look like? specify "should find all users over the given age" do User.should_receive(:find).with(:all, :conditions => ["age > ?", 18]) User.find_older_than 18 end I don...