<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/migrations/005_create_tournaments.rb</filename>
    </added>
    <added>
      <filename>lib/obs_tournament.rb</filename>
    </added>
    <added>
      <filename>lib/obs_tournament_participation.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,11 +1,6 @@
 Infrastructure
+  * Rename Tournament -&gt; Event
   * Rename Tournament Participation -&gt; Registration
   * Rename RaceParticipation -&gt; Performance
-  * windows packaging
-  * OSX packaging
-
-Tournaments
-  * add specific racers to a match
-
-Race Edit
-  * add a racer directly in the race edit
+  * Windows Packaging
+  * OSX Packaging</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@ class ObsRace
   property :id, Serial
   property :raced, Boolean, :default =&gt; false
   has n, :obs_race_participations
-  belongs_to :tournament, :nullable =&gt; true
+  belongs_to :obs_tournament, :nullable =&gt; true
 
   def racers
     obs_race_participations.map(&amp;:obs_racer)
@@ -14,7 +14,7 @@ class ObsRace
   end
 
   def next_race
-    (tournament.obs_races.all(:raced =&gt; false) - [self]).first
+    (obs_tournament.obs_races.all(:raced =&gt; false) - [self]).first
   end
 
   def winner</diff>
      <filename>lib/obs_race.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,8 +5,8 @@ class ObsRacer
 
   has n, :obs_race_participations
 #  has n, :races, :through =&gt; :race_participations
-  has n, :tournament_participations
-  has n, :tournaments, :through =&gt; :tournament_participations
+  has n, :obs_tournament_participations
+  has n, :obs_tournaments, :through =&gt; :obs_tournament_participations
   has n, :obs_categorizations
   
   def categories</diff>
      <filename>lib/obs_racer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 class Race &lt; Sequel::Model
   one_to_many :race_participations
   many_to_many :racers, :join_table =&gt; :race_participations
+  many_to_one :tournament
 
   def finished?
     race_participations.all?(&amp;:finish_time)</diff>
      <filename>lib/race.rb</filename>
    </modified>
    <modified>
      <diff>@@ -144,17 +144,19 @@ else
   Sequel::Migrator.apply(DB, 'lib/migrations/')
 end
 require 'lib/obs_race_participation'
-require 'lib/tournament_participation'
+require 'lib/obs_tournament_participation'
 require 'lib/obs_racer'
 require 'lib/obs_race'
 require 'lib/obs_categorization'
 require 'lib/obs_category'
+require 'lib/obs_tournament'
 require 'lib/category'
-require 'lib/tournament'
 require 'lib/racer'
 require 'lib/race'
 require 'lib/race_participation'
 require 'lib/categorization'
+require 'lib/tournament'
+require 'lib/tournament_participation'
 require &quot;lib/race_windows/#{options['track']}&quot;
 if(first_time||!defined? Shoes)
   DataMapper.auto_migrate!</diff>
      <filename>lib/setup.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,49 +1,34 @@
-class Tournament
-  include DataMapper::Resource
-  property :id, Serial
-  property :name, String
-  has n, :obs_races
+class Tournament &lt; Sequel::Model
+  one_to_many :tournament_participations
+  many_to_many :racers, :join_table =&gt; :tournament_participations
+  one_to_many :races
 
-  has n, :tournament_participations
-  has n, :obs_racers, :through =&gt; :tournament_participations, :mutable =&gt; true
-
-  def racers
-    tournament_participations.map(&amp;:obs_racer)
+  #TODO: optimize
+  def unregistered_racers
+    Racer.all - self.racers
   end
 
   def autofill(racer_list=nil)
     racer_list ||= reload.unmatched_racers.to_a
     racer_list.each_slice($BIKES.length) { |a|
-      obs_races.create(:obs_race_participations =&gt; a.map{|r| {:obs_racer =&gt; r}})
+      race = Race.create(:tournament =&gt; self)
+      a.map{|r| RaceParticipation.create(:racer =&gt; r, :race =&gt; race)}
     }
   end
 
   def unmatched_racers
-    racers - matched_racers - tournament_participations.all(:eliminated =&gt; true).obs_racers
-  end
-
-  def never_raced_and_not_eliminated
-    matched = []
-    obs_races.each { |race|
-      race.obs_race_participations.each {|rp|
-        matched &lt;&lt; rp.obs_racer
-      }
-    }
-    racers - matched - tournament_participations.all(:eliminated =&gt; true).obs_racers
-  end
-
-  def unregistered_racers
-    ObsRacer.all - racers
+    racers - matched_racers - tournament_participations.select{|tp|tp.eliminated}.map{|tp|tp.racer}
   end
 
   def matched_racers
     matched = []
-    matches = self.obs_races.select{|race| race.unraced? }
+    matches = self.races.select{|race| race.unraced? }
     matches.each { |race|
-      race.obs_race_participations.each {|rp|
-        matched &lt;&lt; rp.obs_racer
+      race.race_participations.each {|rp|
+        matched &lt;&lt; rp.racer
       }
     }
     matched
   end
+
 end</diff>
      <filename>lib/tournament.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,34 +1,25 @@
-class TournamentParticipation
-  include DataMapper::Resource
-  property :id, Serial
-  property :eliminated, Boolean
-
-  belongs_to :obs_racer
-  belongs_to :tournament
+class TournamentParticipation &lt; Sequel::Model
+  many_to_one :racer
+  many_to_one :tournament
 
   def best_time
-    best = ObsRaceParticipation.first(&quot;obs_race.tournament_id&quot; =&gt; tournament.id,
-                            :obs_racer_id =&gt; obs_racer.id,
-                            :order =&gt; [:finish_time.asc]
-    )
-    best.finish_time if best
+    best = DB[:race_participations].filter(:racer_id =&gt; racer.id).join(:races, :tournament_id =&gt; tournament.id).order(:finish_time).select(:finish_time).first
+
+    best[:finish_time] if best
   end
 
+  #TODO: optimize / convert to sequel
   def rank
-    standings = self.tournament.tournament_participations.sort_by{|tp|[tp.best_time||Infinity]}
+    standings = self.tournament.tournament_participations.sort_by{|tp|tp.best_time||Infinity}
     standings.index(self)+1
   end
 
   def losses
-    (ObsRaceParticipation.all(:obs_racer_id =&gt; self.obs_racer_id, &quot;obs_race.tournament_id&quot; =&gt; self.tournament_id).select {|rp| rp.obs_race.winner != rp }).length
-  end
-
-  def race_participations
-    ObsRaceParticipation.all(&quot;obs_race.tournament_id&quot; =&gt; tournament.id,
-                          :obs_racer =&gt; obs_racer)
+    RaceParticipation.filter(:racer_id =&gt; racer.id).join(:races, :tournament_id =&gt; tournament.id).group(:id).all.select{|rp|rp.race.winner.racer.pk != self.racer.pk}.length
   end
 
   def eliminate
-    self.update_attributes(:eliminated =&gt; true)
+    self.update(:eliminated =&gt; true)
   end
+
 end</diff>
      <filename>lib/tournament_participation.rb</filename>
    </modified>
    <modified>
      <diff>@@ -26,7 +26,7 @@ ObsCategory.create(:name =&gt; &quot;Women&quot;)
 ObsCategory.create(:name =&gt; &quot;Men&quot;)
 Category.create(:name =&gt; &quot;Women&quot;)
 Category.create(:name =&gt; &quot;Men&quot;)
-t = Tournament.create(:name =&gt; &quot;December Series&quot;)
+t = obs_Tournament.create(:name =&gt; &quot;December Series&quot;)
 ObsRacer.all.each{|r|
-  t.tournament_participations.create(:obs_racer =&gt; r)
+  t.obs_tournament_participations.create(:obs_racer =&gt; r)
 }</diff>
      <filename>test/fixtures.rb</filename>
    </modified>
    <modified>
      <diff>@@ -77,17 +77,17 @@ describe 'An obsolete race' do
 
   describe 'next race' do
     it 'should be the next one after this one' do
-      t = Tournament.create
-      r1 = ObsRace.create(:tournament =&gt; t)
-      r2 = ObsRace.create(:tournament =&gt; t)
+      t = ObsTournament.create
+      r1 = ObsRace.create(:obs_tournament =&gt; t)
+      r2 = ObsRace.create(:obs_tournament =&gt; t)
       r1.next_race.should==(r2)
     end
 
     it 'should only show the next unraced race' do
-      t = Tournament.create
-      r1 = ObsRace.create(:tournament =&gt; t)
-      r2 = ObsRace.create(:tournament =&gt; t, :raced =&gt; true)
-      r3 = ObsRace.create(:tournament =&gt; t)
+      t = ObsTournament.create
+      r1 = ObsRace.create(:obs_tournament =&gt; t)
+      r2 = ObsRace.create(:obs_tournament =&gt; t, :raced =&gt; true)
+      r3 = ObsRace.create(:obs_tournament =&gt; t)
       r1.next_race.should==(r3)
     end
   end</diff>
      <filename>test/test_race.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,14 @@
 require 'lib/setup.rb'
 require 'bacon'
 
-describe 'A tournament' do
+describe 'An obsolete tournament' do
   before do
-    @tournament = Tournament.new
+    @tournament = ObsTournament.new
     $BIKES = [&quot;red&quot;, &quot;blue&quot;]
   end
 
   it 'should have some racers' do
-    3.times { @tournament.tournament_participations.build(:obs_racer =&gt; ObsRacer.new) }
+    3.times { @tournament.obs_tournament_participations.build(:obs_racer =&gt; ObsRacer.new) }
     @tournament.racers.length.should==3
   end
 
@@ -24,9 +24,9 @@ describe 'A tournament' do
 
   it 'should know the unregistered racers' do
     ObsRacer.all.destroy!
-    @tournament = Tournament.new
+    @tournament = ObsTournament.new
     6.times do
-      @tournament.tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+      @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
     end
     unregistered_racer = ObsRacer.create
     @tournament.unregistered_racers.should==([unregistered_racer])
@@ -37,12 +37,12 @@ describe 'A tournament' do
       @tournament.save
       racers = [&quot;Steve&quot;, &quot;Joe&quot;].map {|racer| ObsRacer.create(:name =&gt; racer) }
       racers.each {|racer|
-        @tournament.tournament_participations.create({:obs_racer =&gt; racer})
+        @tournament.obs_tournament_participations.create({:obs_racer =&gt; racer})
       }
       @tournament.unmatched_racers.should ==(racers)
       sheila = ObsRacer.create(:name =&gt; &quot;Sheila&quot;)
       @tournament.autofill
-      @tournament.tournament_participations.create({:obs_racer =&gt; sheila})
+      @tournament.obs_tournament_participations.create({:obs_racer =&gt; sheila})
       @tournament.unmatched_racers.should ==([sheila])
     end
 
@@ -50,13 +50,13 @@ describe 'A tournament' do
       @tournament.save
       racers = [&quot;Steve&quot;, &quot;Joe&quot;].map {|racer| ObsRacer.create(:name =&gt; racer) }
       racers.each {|racer|
-        @tournament.tournament_participations.create({:obs_racer =&gt; racer})
+        @tournament.obs_tournament_participations.create({:obs_racer =&gt; racer})
       }
       @tournament.unmatched_racers.should ==(racers)
       sheila = ObsRacer.create(:name =&gt; &quot;Sheila&quot;)
       @tournament.autofill
       @tournament.obs_races.each{|r|r.update_attributes(:raced =&gt; true)}
-      @tournament.tournament_participations.create({:obs_racer =&gt; sheila})
+      @tournament.obs_tournament_participations.create({:obs_racer =&gt; sheila})
       @tournament.unmatched_racers.length.should==(3)
       
     end
@@ -65,23 +65,175 @@ describe 'A tournament' do
       @tournament.save
       racers = [&quot;Steve&quot;, &quot;Joe&quot;].map {|racer| ObsRacer.create(:name =&gt; racer) }
       racers.each {|racer|
-        @tournament.tournament_participations.create({:obs_racer =&gt; racer})
+        @tournament.obs_tournament_participations.create({:obs_racer =&gt; racer})
       }
       @tournament.unmatched_racers.should ==(racers)
       sheila = ObsRacer.create(:name =&gt; &quot;Sheila&quot;)
       @tournament.autofill
       @tournament.obs_races.each{|r|r.update_attributes(:raced =&gt; true)}
-      @tournament.tournament_participations.each{|tp|tp.update_attributes(:eliminated =&gt; true)}
-      @tournament.tournament_participations.create({:obs_racer =&gt; sheila})
+      @tournament.obs_tournament_participations.each{|tp|tp.update_attributes(:eliminated =&gt; true)}
+      @tournament.obs_tournament_participations.create({:obs_racer =&gt; sheila})
       @tournament.unmatched_racers.should==([sheila])
     end
   end
 
   describe 'autofill' do
     it 'should result in all the racers being matched' do
-      @tournament = Tournament.new
+      @tournament = ObsTournament.new
+      6.times do
+        @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+      end
+      @tournament.save
+      @tournament.reload
+      @tournament.obs_races.length.should == 0
+      @tournament.autofill
+      @tournament.obs_races.length.should == 3
+      @tournament.save
+    end
+
+    it 'should match only unmatched racers' do
+      @tournament = ObsTournament.new
+      6.times do
+        @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+      end
+      @tournament.save
+      @tournament.reload
+      @tournament.obs_races.length.should == 0
+      @tournament.autofill
+      @tournament.obs_races.length.should == 3
+      @tournament.save
+      6.times do
+        @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+      end
+      @tournament.save
+      @tournament.reload
+      @tournament.autofill
+      @tournament.obs_races.length.should == 6
+    end
+
+    it 'should make races with as many riders as there are bikes' do
+      @tournament = ObsTournament.new
+      $BIKES = [&quot;red&quot;,&quot;blue&quot;,&quot;yellow&quot;]
+      6.times do
+        @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+      end
+      @tournament.save
+      @tournament.reload
+      @tournament.obs_races.length.should == 0
+      @tournament.autofill
+      @tournament.obs_races.length.should == 2
+      @tournament.save
+    end
+
+    it 'should accept a list of racers' do
+      @tournament = ObsTournament.new
+      6.times do
+        @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+      end
+      @tournament.save
+      @tournament.reload
+      @tournament.obs_races.length.should == 0
+      @tournament.autofill(@tournament.obs_tournament_participations.obs_racers[0..2])
+      @tournament.obs_races.length.should == 2
+      @tournament.obs_races.first.racers.length.should == 2
+    end
+  end
+end
+
+describe 'A tournament' do
+  before do
+    @tournament = Tournament.create
+    $BIKES = [&quot;red&quot;, &quot;blue&quot;]
+  end
+
+  it 'should have some racers' do
+    3.times do
+      racer = Racer.create
+      tp = TournamentParticipation.create(:racer =&gt; racer,
+        :tournament =&gt; @tournament)
+    end
+    @tournament.racers.length.should==3
+  end
+
+  it 'should have some races' do
+    3.times do
+      Race.create(:tournament =&gt; @tournament)
+    end
+    @tournament.races.length.should==3
+  end
+
+  it 'should have a name' do
+    @tournament.name = &quot;foo&quot;
+    @tournament.name.should == &quot;foo&quot;
+  end
+
+  it 'should know the unregistered racers' do
+    Racer.all.each{|r|r.destroy}
+    @tournament = Tournament.create
+    6.times do
+      TournamentParticipation.create(:racer =&gt; Racer.create,
+        :tournament =&gt; @tournament)
+    end
+    unregistered_racer = Racer.create
+    @tournament.unregistered_racers.should==([unregistered_racer])
+  end
+
+  describe 'unmatched_racers' do
+    it 'should contain racers not in a match' do
+      @tournament.save
+      racers = [&quot;Steve&quot;, &quot;Joe&quot;].map {|racer| Racer.create(:name =&gt; racer) }
+      racers.each {|racer|
+        TournamentParticipation.create(:racer =&gt; racer,
+          :tournament =&gt; @tournament)
+      }
+      @tournament.unmatched_racers.should ==(racers)
+      sheila = Racer.create(:name =&gt; &quot;Sheila&quot;)
+      @tournament.autofill
+      TournamentParticipation.create(:racer =&gt; sheila,
+        :tournament =&gt; @tournament)
+      @tournament.reload.unmatched_racers.should ==([sheila])
+    end
+
+    it 'should contain racers in a completed match.' do
+      @tournament.save
+      racers = [&quot;Steve&quot;, &quot;Joe&quot;].map {|racer| Racer.create(:name =&gt; racer) }
+      racers.each {|racer|
+        TournamentParticipation.create(:racer =&gt; racer,
+          :tournament =&gt; @tournament)
+      }
+      @tournament.unmatched_racers.should ==(racers)
+      sheila = Racer.create(:name =&gt; &quot;Sheila&quot;)
+      @tournament.autofill
+      @tournament.races.each{|r|r.raced = true; r.save}
+      TournamentParticipation.create(:racer =&gt; sheila,
+        :tournament =&gt; @tournament)
+      @tournament.reload.unmatched_racers.length.should==(3)
+    end
+
+    it 'should not contain eliminated racers' do
+      @tournament.save
+      racers = [&quot;Steve&quot;, &quot;Joe&quot;].map {|racer| Racer.create(:name =&gt; racer) }
+      racers.each {|racer|
+        TournamentParticipation.create(:racer =&gt; racer,
+          :tournament =&gt; @tournament)
+      }
+      @tournament.unmatched_racers.should ==(racers)
+
+      sheila = Racer.create(:name =&gt; &quot;Sheila&quot;)
+      @tournament.autofill
+      @tournament.races.each{|r|r.raced = true; r.save}
+      @tournament.tournament_participations.each{|tp|tp.eliminated = true; tp.save}
+      TournamentParticipation.create(:racer =&gt; sheila,
+        :tournament =&gt; @tournament)
+      @tournament.reload.unmatched_racers.should==([sheila])
+    end
+  end
+
+  describe 'autofill' do
+    it 'should result in all the racers being matched' do
+      @tournament = ObsTournament.new
       6.times do
-        @tournament.tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+        @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
       end
       @tournament.save
       @tournament.reload
@@ -92,9 +244,9 @@ describe 'A tournament' do
     end
 
     it 'should match only unmatched racers' do
-      @tournament = Tournament.new
+      @tournament = ObsTournament.new
       6.times do
-        @tournament.tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+        @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
       end
       @tournament.save
       @tournament.reload
@@ -103,7 +255,7 @@ describe 'A tournament' do
       @tournament.obs_races.length.should == 3
       @tournament.save
       6.times do
-        @tournament.tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+        @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
       end
       @tournament.save
       @tournament.reload
@@ -112,10 +264,10 @@ describe 'A tournament' do
     end
 
     it 'should make races with as many riders as there are bikes' do
-      @tournament = Tournament.new
+      @tournament = ObsTournament.new
       $BIKES = [&quot;red&quot;,&quot;blue&quot;,&quot;yellow&quot;]
       6.times do
-        @tournament.tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+        @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
       end
       @tournament.save
       @tournament.reload
@@ -126,14 +278,14 @@ describe 'A tournament' do
     end
 
     it 'should accept a list of racers' do
-      @tournament = Tournament.new
+      @tournament = ObsTournament.new
       6.times do
-        @tournament.tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
+        @tournament.obs_tournament_participations.build({:obs_racer =&gt; ObsRacer.create})
       end
       @tournament.save
       @tournament.reload
       @tournament.obs_races.length.should == 0
-      @tournament.autofill(@tournament.tournament_participations.obs_racers[0..2])
+      @tournament.autofill(@tournament.obs_tournament_participations.obs_racers[0..2])
       @tournament.obs_races.length.should == 2
       @tournament.obs_races.first.racers.length.should == 2
     end</diff>
      <filename>test/test_tournament.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,22 +1,22 @@
 require 'lib/setup.rb'
 require 'bacon'
 
-describe 'A tournament participation' do
+describe 'An obsolete tournament participation' do
   before do
-    @tournament = Tournament.create(:name =&gt; &quot;December&quot;)
+    @tournament = ObsTournament.create(:name =&gt; &quot;December&quot;)
     @racer = ObsRacer.create(:name =&gt; &quot;winston&quot;)
-    @tournament_participation = TournamentParticipation.create(:obs_racer =&gt; @racer, :tournament =&gt; @tournament)
+    @tournament_participation = ObsTournamentParticipation.create(:obs_racer =&gt; @racer, :obs_tournament =&gt; @tournament)
     [4.2, 5.3, 3.0, 6.1].each do |time|
-      r = ObsRace.create(:tournament =&gt; @tournament)
+      r = ObsRace.create(:obs_tournament =&gt; @tournament)
       r.obs_race_participations.create(:obs_racer =&gt; @racer, :finish_time =&gt; time)
     end
 
     @racer2 = ObsRacer.create(:name =&gt; &quot;winston&quot;)
-    @tournament_participation2 = TournamentParticipation.create(:obs_racer =&gt; @racer2, :tournament =&gt; @tournament)
+    @tournament_participation2 = ObsTournamentParticipation.create(:obs_racer =&gt; @racer2, :obs_tournament =&gt; @tournament)
 
     @racer3 = ObsRacer.create(:name =&gt; &quot;winston&quot;)
-    @tournament_participation3 = TournamentParticipation.create(:obs_racer =&gt; @racer3, :tournament =&gt; @tournament)
-    r = ObsRace.create(:tournament =&gt; @tournament)
+    @tournament_participation3 = ObsTournamentParticipation.create(:obs_racer =&gt; @racer3, :obs_tournament =&gt; @tournament)
+    r = ObsRace.create(:obs_tournament =&gt; @tournament)
     r.obs_race_participations.create(:obs_racer =&gt; @racer3, :finish_time =&gt; [10.0])
     r.obs_race_participations.create(:obs_racer =&gt; @racer, :finish_time =&gt; [5.0])
   end
@@ -44,3 +44,47 @@ describe 'A tournament participation' do
 
 
 end
+describe 'A tournament participation' do
+  before do
+    @tournament = Tournament.create(:name =&gt; &quot;December&quot;)
+    @racer = Racer.create(:name =&gt; &quot;winston&quot;)
+    @tournament_participation = TournamentParticipation.create(:racer =&gt; @racer, :tournament =&gt; @tournament)
+    [4.2, 5.3, 3.0, 6.1].each do |time|
+      r = Race.create(:tournament =&gt; @tournament)
+      RaceParticipation.create(:racer =&gt; @racer, :race =&gt; r, 
+        :finish_time =&gt; time)
+    end
+
+    @racer2 = Racer.create(:name =&gt; &quot;winston&quot;)
+    @tournament_participation2 = TournamentParticipation.create(:racer =&gt; @racer2, :tournament =&gt; @tournament)
+
+    @racer3 = Racer.create(:name =&gt; &quot;winston&quot;)
+    @tournament_participation3 = TournamentParticipation.create(:racer =&gt; @racer3, :tournament =&gt; @tournament)
+    r = Race.create(:tournament =&gt; @tournament)
+    RaceParticipation.create(:racer =&gt; @racer3, :race =&gt; r, 
+      :finish_time =&gt; 10.0)
+    RaceParticipation.create(:racer =&gt; @racer, :race =&gt; r, 
+      :finish_time =&gt; 5.0)
+  end
+
+  
+  it 'should have a best time' do
+    @tournament_participation.best_time.should==(3.0)
+  end
+  it 'should not have a best time if the racer has not raced' do
+    @tournament_participation2.best_time.should==(nil)
+  end
+
+  it 'should have a relative rank' do
+    @tournament_participation.rank.should==(1)
+    @tournament_participation2.rank.should==(3)
+    @tournament_participation3.rank.should==(2)
+  end
+
+  it 'should have a number of losses for eliminaton' do
+    @tournament_participation.losses.should==(0)
+    @tournament_participation2.losses.should==(0)
+    @tournament_participation3.losses.should==(1)
+  end
+
+end</diff>
      <filename>test/test_tournament_participation.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4f5c869f724acfd7f89fd2fb5c1787e79041b750</id>
    </parent>
  </parents>
  <author>
    <name>Evan Farrar</name>
    <email>evanfarrar@gmail.com</email>
  </author>
  <url>http://github.com/evanfarrar/opensprints/commit/45bc3326a4346f8ffe6abe7926e4c8733ddf15ed</url>
  <id>45bc3326a4346f8ffe6abe7926e4c8733ddf15ed</id>
  <committed-date>2009-10-06T13:42:08-07:00</committed-date>
  <authored-date>2009-10-06T13:42:08-07:00</authored-date>
  <message>Migrated tournament to sequel (the last model).</message>
  <tree>b59903131f85b31473c9eeac372905039a36cef9</tree>
  <committer>
    <name>Evan Farrar</name>
    <email>evanfarrar@gmail.com</email>
  </committer>
</commit>
