forked from makersacademy/airport_challenge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User story 1 complete. Iinitially tried to create the function airpor…
…t.land(plane) which seemed to be working until the point where I had to push the plane into the array, so I refactored my tests to to follow the walkthrough more closely and have the land function in the Plane class.
- Loading branch information
1 parent
7d801ab
commit fbfb1a3
Showing
5 changed files
with
22 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
'use strict' | ||
describe('Plane', function(){ | ||
var plane; | ||
var airport | ||
beforeEach(function(){ | ||
plane = new Plane(); | ||
airport = jasmine.createSpyObj('airport',['clearForLanding']); | ||
}); | ||
it('can land at an airport', function(){ | ||
plane.land(airport); | ||
expect(airport.clearForLanding).toHaveBeenCalledWith(plane); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
'use strict' | ||
class Airport{ | ||
|
||
land(){ | ||
|
||
}; | ||
constructor(){ | ||
this._runway = [] | ||
} | ||
|
||
planes(){ | ||
return []; | ||
return this._runway; | ||
}; | ||
|
||
clearForLanding(plane) { | ||
this._runway.push(plane) | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
'use strict' | ||
class Plane{ | ||
|
||
land(airport){ | ||
airport.clearForLanding(this) | ||
}; | ||
} |