spec/javascripts/jasmine.headless-reporter_spec.coffee in jasmine-headless-webkit-0.6.3 vs spec/javascripts/jasmine.headless-reporter_spec.coffee in jasmine-headless-webkit-0.7.0
- old
+ new
@@ -7,16 +7,13 @@
'test': [ 3, 10 ],
'other': [ 7 ]
}
}
it 'should find the best spec lines', ->
- result = new HeadlessReporterResult('test', [ 'name', 'of', 'test' ])
- expect(result._findSpecLine().lineNumber).toEqual(3)
+ expect(HeadlessReporterResult.findSpecLine([ 'name', 'of', 'test' ]).lineNumber).toEqual(3)
+ expect(HeadlessReporterResult.findSpecLine([ 'other', 'of', 'test' ]).lineNumber).toEqual(10)
- result = new HeadlessReporterResult('test', [ 'other', 'of', 'test' ])
- expect(result._findSpecLine().lineNumber).toEqual(10)
-
describe 'jasmine.HeadlessReporter', ->
reporter = null
beforeEach ->
reporter = new jasmine.HeadlessReporter()
@@ -33,6 +30,67 @@
reporter.reportSpecStarting(spec)
expect(spec.finish).toHaveBeenCalled()
expect(suite.finish).toHaveBeenCalled()
+
+describe 'jasmine.Suite.prototype.getSuiteSplitName', ->
+ it 'should flatten the description', ->
+ suite = new jasmine.Suite({});
+ suite.description = "hello\ngoodbye\n";
+ expect(suite.getSuiteSplitName()).toEqual([ "hello goodbye " ])
+
+ it 'should not fail on missing description', ->
+ suite = new jasmine.Suite({});
+ suite.description = 1;
+ expect(suite.getSuiteSplitName()).toEqual([ "1" ])
+
+describe 'jasmine.Spec.prototype.getSuiteSplitName', ->
+ it 'should flatten the description', ->
+ spec = new jasmine.Spec({}, {});
+ spec.suite = {
+ getSuiteSplitName: -> []
+ }
+ spec.description = "hello\ngoodbye\n";
+ expect(spec.getSpecSplitName()).toEqual([ "hello goodbye " ])
+
+ it 'should not fail on missing description', ->
+ spec = new jasmine.Spec({}, {});
+ spec.suite = {
+ getSuiteSplitName: -> []
+ }
+ spec.description = 1
+ expect(spec.getSpecSplitName()).toEqual([ "1" ])
+
+describe 'jasmine.Spec.prototype.getJHWSpecInformation', ->
+ it 'should append null when there is no file information', ->
+ spec = new jasmine.Spec({}, {})
+ spyOn(spec, 'getSpecSplitName').andReturn(["one"])
+ spyOn(HeadlessReporterResult, 'findSpecLine').andReturn({})
+ expect(spec.getJHWSpecInformation()).toEqual("one||")
+
+describe 'jasmine.WaitsBlock and jasmine.WaitsForBlock', ->
+ beforeEach ->
+ it 'should notify JHW of waiting', ->
+ waits(5500)
+ runs ->
+ expect(true).toEqual(true)
+
+ it 'should notify JHW of waiting for something', ->
+ value = false
+
+ setTimeout(
+ ->
+ value = true
+ , 5000
+ )
+
+ waitsFor(
+ ->
+ value
+ , "Nope"
+ 5500
+ )
+
+ runs ->
+ expect(true).toEqual(true)