Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:MikeHoffert/EatSafe into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
KatrinaHoffert committed Mar 10, 2015
2 parents b0965f5 + 82e6c8c commit aa79812
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions database/test/test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ INSERT INTO violation(inspection_id, violation_id)
VALUES (3, 14);

INSERT INTO location(id, name, address, postcode, city, rha)
VALUES (2, 'Water Front Lodge', 'Unknown', 'Unknown', '#1 Johnson Street', 'Northern Health - Mamaw/Keewa/Athab');
VALUES (2, 'Water Front Lodge', null, null, '#1 Johnson Street', 'Northern Health - Mamaw/Keewa/Athab');

INSERT INTO inspection(id, location_id, inspection_date, inspection_type, reinspection_priority)
VALUES (4, 2, '2014-09-23', 'Routine', 'Low');
Expand All @@ -78,7 +78,7 @@ INSERT INTO violation(inspection_id, violation_id)
VALUES (6, 12);

INSERT INTO location(id, name, address, postcode, city, rha)
VALUES (3, 'Robinson Country Cookhouse & Saloon', 'Cupar', 'Unknown', 'Cupar', 'Regina QuAppelle Health Authority');
VALUES (3, 'Robinson Country Cookhouse & Saloon', 'Cupar', null, 'Cupar', 'Regina QuAppelle Health Authority');

INSERT INTO inspection(id, location_id, inspection_date, inspection_type, reinspection_priority)
VALUES (7, 3, '2014-02-14', 'Routine', 'Low');
Expand Down
12 changes: 7 additions & 5 deletions test/ApplicationSpecMainTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ApplicationSpecMainTest extends Specification {

"give error page when an invalid city url is requested" in new WithApplication {
val error = route(FakeRequest(GET, "/find/octavia")).get
assert(status(error) must equalTo(OK))
assert(status(error) must equalTo(404))
assert(contentAsString(error) must contain(Messages("errors.emptyCityDesc")))
}

Expand All @@ -90,7 +90,8 @@ class ApplicationSpecMainTest extends Specification {
typeahead.click
typeahead.sendKeys("SASKATOON")
typeahead.sendKeys(Keys.ENTER)
assert(browser.url must contain("/find/Saskatoon"))
assert(browser.url must contain("/find/SASKATOON"))
browser.title() must contain(Messages("locations.selectLocation.title"))//made it to not an aerror page
}

"display choose location page when location is typed in all lowercase" in new WithBrowser {
Expand All @@ -99,7 +100,8 @@ class ApplicationSpecMainTest extends Specification {
typeahead.click
typeahead.sendKeys("saskatoon")
typeahead.sendKeys(Keys.ENTER)
assert(browser.url must contain("/find/Saskatoon"))
assert(browser.url must contain("/find/saskatoon"))
browser.title() must contain(Messages("locations.selectLocation.title"))
}

"display choose location page when location is fully typed and submitted with enter" in new WithBrowser {
Expand Down Expand Up @@ -153,7 +155,7 @@ class ApplicationSpecMainTest extends Specification {

"display location page" should {
"display show map page when address is clicked" in new WithBrowser {
browser.goTo("/view/1")
browser.goTo("/view/3675")
val action = new Actions(browser.getDriver)
action.moveToElement(browser.webDriver.findElement(By.tagName("a"))).perform
action.click.perform
Expand Down Expand Up @@ -191,7 +193,7 @@ class ApplicationSpecMainTest extends Specification {
"display map page" should {
"render a map on the page with a header" in new WithBrowser {
//Navigate to a page with a map (uses previously tested navigation)
browser.goTo("/view/1")
browser.goTo("/view/3675")//this page needs to have a map link
val action = new Actions(browser.getDriver)
action.moveToElement(browser.webDriver.findElement(By.tagName("a"))).perform
action.click.perform
Expand Down
2 changes: 1 addition & 1 deletion test/IntegrationSpecMainTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class IntegrationSpecMainTest extends Specification {

"display error for incorrect city but remain on current page" in new WithApplication {
val result = controllers.LocationController.findLocation("#DOESNTEXIST")(FakeRequest())
assert(status(result) == OK)
assert(status(result) must beEqualTo (404))
}

}
Expand Down
6 changes: 3 additions & 3 deletions test/LocationSpecMainTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class LocationSpecMainTest extends Specification with Mockito {
location.id must beEqualTo(7)
// Ignore space due to trailing whitespace
location.name must beEqualTo("Hogwarts Dining Hall").ignoreSpace
location.address must beEqualTo("Hogwarts Place").ignoreSpace
location.postalCode must beEqualTo("S0G 2J0").ignoreSpace
location.address.get must beEqualTo("Hogwarts Place").ignoreSpace
location.postalCode.get must beEqualTo("S0G 2J0").ignoreSpace
}

"return a failure if there is a bad database" in new WithApplication {
Expand Down Expand Up @@ -79,7 +79,7 @@ class LocationSpecMainTest extends Specification with Mockito {
"listCities" should {
"list all cities with resteraunts in saskatchewan" in new WithApplication {
val listOfCities = Location.listCities();
listOfCities.get.length must beEqualTo(6)
listOfCities.get.length must beEqualTo(6+1)//the plus 1 is for Unknown City
}
"list should be in alphabetical order" in new WithApplication {
val listOfCities = Location.listCities();
Expand Down
8 changes: 4 additions & 4 deletions test/ParserSpecMainTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,17 @@ class ParserSpecMainTest extends Specification {
robinsonRow[String]("name") must beEqualTo("Robinson Country Cookhouse & Saloon")
robinsonRow[String]("address") must beEqualTo("Cupar")
robinsonRow[String]("city") must beEqualTo("Cupar")
robinsonRow[String]("postcode") must beEqualTo("Unknown")
robinsonRow[Option[String]]("postcode") must beEqualTo(None)
robinsonRow[String]("rha") must beEqualTo("Regina QuAppelle Health Authority")
tastyRow[String]("name") must beEqualTo("Tasty J's")
tastyRow[String]("address") must beEqualTo("305 Pacific Avenue")
tastyRow[String]("city") must beEqualTo("Luseland")
tastyRow[String]("postcode") must beEqualTo("S0L 2A0")
tastyRow[Option[String]]("postcode").get must beEqualTo("S0L 2A0")
tastyRow[String]("rha") must beEqualTo("Heartland Health Authority")
waterRow[String]("name") must beEqualTo("Water Front Lodge")
waterRow[String]("address") must beEqualTo("Unknown")
waterRow[Option[String]]("address") must beEqualTo(None)
waterRow[String]("city") must beEqualTo("#1 Johnson Street")
waterRow[String]("postcode") must beEqualTo("Unknown")
waterRow[Option[String]]("postcode") must beEqualTo(None)
waterRow[String]("rha") must beEqualTo("Northern Health - Mamaw/Keewa/Athab")
}
}
Expand Down

0 comments on commit aa79812

Please sign in to comment.