Skip to content

Commit

Permalink
Merge branch '1.0-changes'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Berry committed Jun 3, 2015
2 parents e16bbc7 + 63caa74 commit 3f1dc5b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public String getManifest(RequestMode requestMode) throws PropertiesException, C
private void appendManifestHeader(StringBuilder manifest) throws PropertiesException
{
manifest.append("CACHE MANIFEST\n");
manifest.append("# v" + version + "\n\n");
manifest.append("# version " + version + "\n\n");
}

private void appendManifestCacheFiles(StringBuilder manifest, RequestMode requestMode) throws ContentProcessingException, ConfigException, MalformedTokenException, PropertiesException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void testManifestUsesVersionFromConfig() throws Exception
given(app).hasBeenCreated().and(aspect).hasBeenCreated()
.and(brjs).hasVersion("1234");
when(app).requestReceived("appcache/dev.appcache", pageResponse);
then(pageResponse).containsText("# v1234\n");
then(pageResponse).containsText("# version 1234\n");
}

@Test
Expand All @@ -49,7 +49,7 @@ public void testManifestUsesBlankVersionWhenBlankConfig() throws Exception
given(app).hasBeenCreated().and(aspect).hasBeenCreated()
.and(brjs).hasVersion("");
when(app).requestReceived("appcache/dev.appcache", pageResponse);
then(pageResponse).containsText("# v\n");
then(pageResponse).containsText("# version \n");
}

@Test
Expand Down Expand Up @@ -122,5 +122,15 @@ public void manifestIsEmptyIfTheCacheIsDisabled() throws Exception
when(app).requestReceived("appcache/dev.appcache", pageResponse);
then(pageResponse).doesNotContainText("../v/");
}

@Test
public void prodManifestContainsProdRequests() throws Exception
{
given(app).hasBeenCreated().and(aspect).hasBeenCreated()
.and(brjs).hasVersion("1234");
when(app).requestReceived("appcache/prod.appcache", pageResponse);
then(pageResponse).containsLines("../v/1234/prodMock")
.and(pageResponse).doesNotContainText("../v/1234/compositeDev");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,23 @@ public void tearDown()
}

@Test
public void tagHasContentWithVersionGiven() throws Exception
public void tagHasDevContentWithVersionGiven() throws Exception
{
given(aspect).indexPageHasContent("manifest='<@appcache.url@/>'")
.and(brjs).hasVersion("1234");
when(aspect).indexPageLoadedInDev(pageResponse, "en");
then(pageResponse).containsText("manifest='appcache/dev.appcache'");
}

@Test
public void tagHasProdContentWithVersionGiven() throws Exception
{
given(aspect).indexPageHasContent("manifest='<@appcache.url@/>'")
.and(brjs).hasVersion("1234");
when(aspect).indexPageLoadedInProd(pageResponse, "en");
then(pageResponse).containsText("manifest='appcache/prod.appcache'");
}

@Test
public void tagHas404FileWhenVersionRemovedAfterPreviouslyHavingVersion() throws Exception
{
Expand Down

0 comments on commit 3f1dc5b

Please sign in to comment.