@Test public void storeIsDeleted() { Store newStore = new Store("Foot Traffic"); newStore.save(); goTo("http://localhost:4567/stores"); find("a", withText("Delete")).click(); assertThat(pageSource()).doesNotContain("Foot Traffic"); }
@Test public void brandIsAddedToStore() { Brand newBrand = new Brand("Asics"); newBrand.save(); Store newStore = new Store("Foot Traffic"); newStore.save(); newStore.addBrand(newBrand.getId()); goTo("http://localhost:4567/stores/" + newStore.getId()); assertThat(pageSource()).contains("Asics"); }
@Test public void storeIsUpdated() { Store newStore = new Store("Foot Traffic"); newStore.save(); String storePath = String.format("http://localhost:4567/stores/%d/update", newStore.getId()); goTo(storePath); fill("#name").with("Road Runner Sports"); submit("#update_name"); assertThat(pageSource()).contains("Road Runner Sports"); }
@Test public void brandsAndStoresDisplayedCorrectly() { Brand newBrand = new Brand("Nike"); newBrand.save(); Store newStore = new Store("Foot Traffic"); newStore.save(); goTo("http://localhost:4567/"); assertThat(pageSource()).contains("Nike"); assertThat(pageSource()).contains("Foot Traffic"); }