Move specFilter function to TrivialReporter.

This commit is contained in:
Aaron Peckham & Christian Williams
2009-08-10 16:00:42 -07:00
parent e476f2375a
commit b1a007dfb5
4 changed files with 52 additions and 39 deletions

View File

@@ -37,31 +37,11 @@
jasmine.include('suites/RunnerTest.js', true);
jasmine.include('suites/SpecRunningTest.js', true);
jasmine.include('suites/SpyTest.js', true);
jasmine.include('suites/TrivialReporterTest.js', true);
</script>
<style type="text/css">
.spec {
margin: 5px;
}
.passed {
background-color: lightgreen;
}
.failed {
background-color: pink;
}
.resultMessage {
white-space: pre;
}
.stackTrace {
white-space: pre;
font-size: .8em;
margin-left: 10px;
}
</style>
<link href="../lib/jasmine.css" rel="stylesheet"/>
<body>

View File

@@ -0,0 +1,19 @@
describe("TrivialReporter", function() {
function fakeSpec(name) {
return {
getFullName: function() { return name; }
};
}
it("should allow for focused spec running", function() {
var trivialReporter = new jasmine.TrivialReporter();
spyOn(trivialReporter, 'getLocation').andReturn({search: "?spec=run%20this"});
expect(trivialReporter.specFilter(fakeSpec("run this"))).toBeTruthy();
});
it("should not run specs that don't match the filter", function() {
var trivialReporter = new jasmine.TrivialReporter();
spyOn(trivialReporter, 'getLocation').andReturn({search: "?spec=run%20this"});
expect(trivialReporter.specFilter(fakeSpec("not the right spec"))).toBeFalsy();
});
});