Displaying 1 result from an estimated 1 matches for "find_by_tournament_id".
2007 Jan 01
3
Another "how do I spec this?"
...nament" do
@user.should_be_signed_up_for @t1
end
specify "should not be signed up for another tournament" do
@user.should_not_be_signed_up_for @t2
end
end
class User < ActiveRecord::Base
has_many :registrations
def signed_up_for?(tournament)
!registrations.find_by_tournament_id(tournament).nil?
end
end
Are there any potential improvements, or is that the best way to spec it?
Pat