yay, finally a passing spec

This commit is contained in:
Sven Fuchs 2012-06-26 03:56:22 +02:00
parent daed80916b
commit 932219f377
7 changed files with 73 additions and 2430 deletions

View File

@ -56,6 +56,7 @@ input 'assets/javascripts/spec' do
vendor/jasmine.js vendor/jasmine.js
vendor/jasmine-html.js vendor/jasmine-html.js
vendor/jasmine-runner.js vendor/jasmine-runner.js
vendor/sinon.js
) )
concat files, 'specs/vendor.js' concat files, 'specs/vendor.js'
end end

View File

@ -1,10 +1,13 @@
describe 'Foo', -> describe 'Foo', ->
it 'bar', -> beforeEach ->
link = $($('#repositories a.slug')[0]) createApp()
console.log $('body').html() waitFor repositoriesRendered
# link.attr('href').should.equal '#/travis-ci/travis-core'
it 'bar', -> it 'bar', ->
link = $($('#repositories a.slug')[0]) href = $('#repositories a.slug').attr('href')
# link.attr('href').should.equal '#/travis-ci/travis-core' expect(href).toEqual '#/travis-ci/travis-core'
it 'bar', ->
href = $('#repositories a.slug').attr('href')
expect(href).toEqual '#/travis-ci/travis-core'

View File

@ -1,12 +1,27 @@
minispade.require 'app' minispade.require 'app'
beforeEach -> @after = (time, func) ->
waits(time)
jasmine.getEnv().currentSpec.runs(func)
@once = (condition, func) ->
waitsFor(condition)
jasmine.getEnv().currentSpec.runs(func)
@reset = ->
Travis.app.destroy() if Travis.app
$('body #content').empty() $('body #content').empty()
Em.run ->
Travis.app = Travis.App.create()
Travis.app.set('rootElement', '#content')
Travis.app.initialize()
afterEach -> @createApp = ->
Travis.app.destroy() Travis.app = Travis.App.create()
Travis.app.set('rootElement', '#content')
Travis.app.initialize()
@waitFor = waitsFor
@repositoriesRendered = ->
$('#repositories li').length > 0
beforeEach ->
reset()

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,19 @@
(function() { (function() {
describe('Foo', function() { describe('Foo', function() {
beforeEach(function() {
createApp();
return waitFor(repositoriesRendered);
});
it('bar', function() { it('bar', function() {
var link; var href;
link = $($('#repositories a.slug')[0]); href = $('#repositories a.slug').attr('href');
return console.log($('body').html()); return expect(href).toEqual('#/travis-ci/travis-core');
}); });
return it('bar', function() { return it('bar', function() {
var link; var href;
return link = $($('#repositories a.slug')[0]); href = $('#repositories a.slug').attr('href');
return expect(href).toEqual('#/travis-ci/travis-core');
}); });
}); });
@ -17,17 +22,37 @@
minispade.require('app'); minispade.require('app');
beforeEach(function() { this.after = function(time, func) {
$('body #content').empty(); waits(time);
return Em.run(function() { return jasmine.getEnv().currentSpec.runs(func);
Travis.app = Travis.App.create(); };
Travis.app.set('rootElement', '#content');
return Travis.app.initialize();
});
});
afterEach(function() { this.once = function(condition, func) {
return Travis.app.destroy(); waitsFor(condition);
return jasmine.getEnv().currentSpec.runs(func);
};
this.reset = function() {
if (Travis.app) {
Travis.app.destroy();
}
return $('body #content').empty();
};
this.createApp = function() {
Travis.app = Travis.App.create();
Travis.app.set('rootElement', '#content');
return Travis.app.initialize();
};
this.waitFor = waitsFor;
this.repositoriesRendered = function() {
return $('#repositories li').length > 0;
};
beforeEach(function() {
return reset();
}); });
}).call(this); }).call(this);

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@ body {
#left, #main { #left, #main {
float: left; float: left;
height: 500px;
} }
#left { #left {