Skip to content

Commit

Permalink
Trying to figure out why tests arent actually pausing
Browse files Browse the repository at this point in the history
  • Loading branch information
quirkey committed Jul 30, 2011
1 parent 1ab5510 commit aab0186
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/test_sammy_storage.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
(function($) {

with(QUnit) {

var stores = ['memory', 'local', 'session', 'cookie'];

$.each(stores, function(i, store_type) {
var i = 0, l = stores.length;
for (; i < l; i++) {
var store_type = stores[i];
if (Sammy.Store.isAvailable(store_type)) {
context('Sammy.Store', store_type, {
before: function() {
Expand All @@ -20,9 +23,11 @@
type: store_type
});
stop();
console.log('stop in before')
this.store.clearAll(function() {
other_store.clearAll(function() {
start();
console.log('start in before')
});
});
}
Expand All @@ -38,6 +43,7 @@
})
.should('check if a key exists', function() {
expect(4);
console.log('-- stop key exists');
stop();
var store = this.store, other_store = this.other_store;
store.exists('foo', function(foo) {
Expand All @@ -48,6 +54,7 @@
equal(after_set, true);
other_store.exists('foo', function(foo3) {
ok(!foo3);
console.log('-- start key exists');
// start();
});
});
Expand All @@ -57,6 +64,7 @@
.should('set and retrieve value as string', function() {
expect(4);
stop();
console.log('-- stop value as a string');
var store = this.store, other_store = this.other_store;
store.set('foo', 'bar', function(newval, key) {
equal(key, 'foo');
Expand All @@ -65,6 +73,7 @@
equal(val, 'bar');
other_store.get('foo', function(val) {
ok(!val);
console.log(' -- start value as a string')
start();
});
});
Expand Down Expand Up @@ -155,7 +164,7 @@
});
});
}
});
}

context('Sammy.Storage', {
before: function() {
Expand Down
2 changes: 2 additions & 0 deletions vendor/qunit-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
var spec = this;
var spec_context = {};
QUnit.test(name, function() {
console.log('------- test ', name, spec_context);
if (spec.before) spec.before.apply(spec_context);
callback.apply(spec_context, [this, spec]);
if (spec.after) spec.after.apply(spec_context);
console.log('------ finished ', name, spec_context);
});
return spec;
},
Expand Down

0 comments on commit aab0186

Please sign in to comment.