-
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.
Added specification describing behaviour when a custom root index is …
…provided
- Loading branch information
Ben Buckley
committed
Dec 21, 2011
1 parent
756de8a
commit b4775f7
Showing
5 changed files
with
64 additions
and
19 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/test/java/spec/uk/co/codemonkey/concordion/specLinker/DefaultIndexTest.java
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,9 +1,56 @@ | ||
package spec.uk.co.codemonkey.concordion.specLinker; | ||
|
||
import static spec.uk.co.codemonkey.concordion.specLinker.SpecTestHelper.createSpec; | ||
import static spec.uk.co.codemonkey.concordion.specLinker.SpecTestHelper.createSpecDirectory; | ||
import static spec.uk.co.codemonkey.concordion.specLinker.SpecTestHelper.exampleSpec; | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import org.apache.commons.io.IOUtils; | ||
import org.concordion.integration.junit4.ConcordionRunner; | ||
import org.junit.runner.RunWith; | ||
|
||
import uk.co.codemonkey.concordion.specLinker.SpecLinker; | ||
|
||
@RunWith(ConcordionRunner.class) | ||
public class DefaultIndexTest { | ||
|
||
private String fileString; | ||
|
||
public void runLinker(String rootIndex) throws Exception { | ||
File dir = createSpecDirectory("example"); | ||
exampleSpec(dir, rootIndex, "customRootIndex"); | ||
createSpec(dir, "tests/parent.html"); | ||
createSpec(dir, "tests/child.html"); | ||
|
||
String testDir = dir.getCanonicalPath(); | ||
new SpecLinker().link(testDir, testDir); | ||
|
||
fileString = fileAsString(new File(dir, rootIndex)); | ||
|
||
} | ||
|
||
public boolean isSameIndexFile() throws IOException { | ||
return fileString.contains("customRootIndex"); | ||
} | ||
|
||
public boolean containsChildLinks() { | ||
return fileString.contains("tests/parent.html"); | ||
} | ||
|
||
|
||
private String fileAsString(File file) throws IOException { | ||
InputStream in = new FileInputStream(file); | ||
try { | ||
return IOUtils.toString(in); | ||
} | ||
finally { | ||
if(in != null) { in.close(); } | ||
} | ||
|
||
} | ||
|
||
} |
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
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