       expect(@race.getCarLane('blue').at piecePosition).to.eql startLaneIndex: 1, endLaneIndex: 1
 
     it 'returns the given endLaneIndex as lanes for succeeding positions (i.e. no switch assumed afterwards)', ->
-      lane = @race.getCarLane('red')
-      lane.add createPosition 0, 0.0, 0, 0, 1
-      expect(lane.at createPosition 5, 0.0).to.eql startLaneIndex: 1, endLaneIndex: 1
+      @redLane.add createPosition 0, 0.0, 0, 0, 1
+      expect(@redLane.at createPosition 5, 0.0).to.eql startLaneIndex: 1, endLaneIndex: 1
 
     it 'returns an appropriate series of lanes', ->
-      lane = @race.getCarLane('red')
-      lane.add createPosition 0, 0.0, 0, 0, 1
-      lane.add createPosition 3, 0.0, 0, 1, 1
-      lane.add createPosition 5, 0.0, 0, 1, 0
-      lane.add createPosition 39, 0.0, 0, 0, 1
-      lane.add createPosition 3, 0.0, 1, 1, 0
+      @redLane.add createPosition 0, 0.0, 0, 0, 1
+      @redLane.add createPosition 3, 0.0, 0, 1, 1
+      @redLane.add createPosition 5, 0.0, 0, 1, 0
+      @redLane.add createPosition 39, 0.0, 0, 0, 1
+      @redLane.add createPosition 3, 0.0, 1, 1, 0
 
-      expect(lane.at createPosition 0, 0.0).to.eql startLaneIndex: 0, endLaneIndex: 1
-      expect(lane.at createPosition 1, 0.0).to.eql startLaneIndex: 1, endLaneIndex: 1
-      expect(lane.at createPosition 3, 0.0).to.eql startLaneIndex: 1, endLaneIndex: 1
-      expect(lane.at createPosition 4, 0.0).to.eql startLaneIndex: 1, endLaneIndex: 1
-      expect(lane.at createPosition 5, 0.0).to.eql startLaneIndex: 1, endLaneIndex: 0
-      expect(lane.at createPosition 6, 0.0).to.eql startLaneIndex: 0, endLaneIndex: 0
-      expect(lane.at createPosition 38, 0.0).to.eql startLaneIndex: 0, endLaneIndex: 0
-      expect(lane.at createPosition 39, 0.0).to.eql startLaneIndex: 0, endLaneIndex: 1
-      expect(lane.at createPosition 0, 0.0, 1).to.eql startLaneIndex: 1, endLaneIndex: 1
-      expect(lane.at createPosition 2, 0.0, 1).to.eql startLaneIndex: 1, endLaneIndex: 1
-      expect(lane.at createPosition 3, 0.0, 1).to.eql startLaneIndex: 1, endLaneIndex: 0
-      expect(lane.at createPosition 4, 0.0, 1).to.eql startLaneIndex: 0, endLaneIndex: 0
+      expect(@redLane.at createPosition 0, 0.0).to.eql startLaneIndex: 0, endLaneIndex: 1
+      expect(@redLane.at createPosition 1, 0.0).to.eql startLaneIndex: 1, endLaneIndex: 1
+      expect(@redLane.at createPosition 3, 0.0).to.eql startLaneIndex: 1, endLaneIndex: 1
+      expect(@redLane.at createPosition 4, 0.0).to.eql startLaneIndex: 1, endLaneIndex: 1
+      expect(@redLane.at createPosition 5, 0.0).to.eql startLaneIndex: 1, endLaneIndex: 0
+      expect(@redLane.at createPosition 6, 0.0).to.eql startLaneIndex: 0, endLaneIndex: 0
+      expect(@redLane.at createPosition 38, 0.0).to.eql startLaneIndex: 0, endLaneIndex: 0
+      expect(@redLane.at createPosition 39, 0.0).to.eql startLaneIndex: 0, endLaneIndex: 1
+      expect(@redLane.at createPosition 0, 0.0, 1).to.eql startLaneIndex: 1, endLaneIndex: 1
+      expect(@redLane.at createPosition 2, 0.0, 1).to.eql startLaneIndex: 1, endLaneIndex: 1
+      expect(@redLane.at createPosition 3, 0.0, 1).to.eql startLaneIndex: 1, endLaneIndex: 0
+      expect(@redLane.at createPosition 4, 0.0, 1).to.eql startLaneIndex: 0, endLaneIndex: 0
 
   describe 'distance calculation', ->
     it 'results in 0 for beginning of first piece', ->

      expect(@race.distance piecePosition, initialPosition, 'red').to.approximate(86.3937)
      expect(@race.distance piecePosition, initialPosition, 'blue').to.approximate(70.6858)



createPosition = race.createPosition

describe 'The race', ->
  beforeEach ->
    @race = race.create sampleRace
    @redLane = @race.getCarLane 'red'

  describe 'car lane', ->
    piecePosition = createPosition 0, 0.0

    it 'returns lane 0, 0 as default', ->
      expect(@redLane.at piecePosition).to.eql startLaneIndex: 0, endLaneIndex: 0

    it 'returns the given lane for the position', ->
      @redLane.add createPosition 0, 0.0, 0, 1, 0
      expect(@redLane.at piecePosition).to.eql startLaneIndex: 1, endLaneIndex: 0

    it 'does not change the lanes stored by race', ->
      @redLane.add createPosition 0, 0.0, 0, 1, 1
      expect(@race.getCarLane('red').at piecePosition).to.eql startLaneIndex: 0, endLaneIndex: 0

    it 'reflects the lanes stored by the race so far', ->
