Allow writes on a collection used in tests

This commit is contained in:
Avital Oliver
2012-07-10 13:32:39 -07:00
committed by Nick Martin
parent 74ad9390db
commit 556aba22ac
2 changed files with 11 additions and 2 deletions

View File

@@ -55,6 +55,12 @@ if (Meteor.is_server) {
/*****/
Ledger = new Meteor.Collection("ledger");
Ledger.allow({
insert: function() { return true; },
update: function() { return true; },
remove: function() { return true; },
fetch: []
});
Meteor.startup(function () {
if (Meteor.is_server)

View File

@@ -204,12 +204,14 @@ testAsyncMulti("livedata - basic method invocation", [
]);
var checkBalances = function (test, a, b) {
var alice = Ledger.findOne({name: "alice", world: test.runId()});
var bob = Ledger.findOne({name: "bob", world: test.runId()});
test.equal(alice.balance, a);
test.equal(bob.balance, b);
}
};
var onQuiesce = function (f) {
if (Meteor.is_server)
@@ -224,6 +226,7 @@ testAsyncMulti("livedata - compound methods", [
function (test) {
if (Meteor.is_client)
Meteor.subscribe("ledger", test.runId());
Ledger.insert({name: "alice", balance: 100, world: test.runId()});
Ledger.insert({name: "bob", balance: 50, world: test.runId()});
},
@@ -236,7 +239,7 @@ testAsyncMulti("livedata - compound methods", [
var release = expect();
onQuiesce(function () {
checkBalances(test, 90, 60);
Tinytest.defer(release);
Tinytest.defer(release); // XXX (why) do we need Tinytest.defer?
});
},
function (test, expect) {