Displaying 1 result from an estimated 1 matches for "signed_up_for".
2007 Jan 01
3
Another "how do I spec this?"
...p do
@t1 = Tournament.new
@t1.save false
@t2 = Tournament.new
@t2.save false
@user = User.new
@user.save false
@user.registrations << Registration.new(:tournament => @t1)
end
specify "should be signed up for that tournament" 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...