Skip to content

Commit

Permalink
Added service method to BuildingsService to update the number of sola…
Browse files Browse the repository at this point in the history
…r satellites.
  • Loading branch information
skiwi2 committed Jan 8, 2016
1 parent c31a0cd commit 5eb6c30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions grails-app/services/com/ognext/BuildingsService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ class BuildingsService {
planet.buildings.terraformer = terraformer
planet.save()
}

void updatePlanetSolarSatellite(Planet planet, Integer solarSatellite) {
planet.buildings.solarSatellite = solarSatellite
planet.save()
}
}
8 changes: 8 additions & 0 deletions src/test/groovy/com/ognext/BuildingsServiceSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,12 @@ class BuildingsServiceSpec extends Specification {
planet.buildings.naniteFactory == 0
planet.buildings.terraformer == 0
}

void "test update planet solar satellite"() {
when: "update planet solar satellite"
service.updatePlanetSolarSatellite(planet, 5)

then: "planet solar satellite should be updated"
planet.buildings.solarSatellite == 5
}
}

0 comments on commit 5eb6c30

Please sign in to comment.