mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Allow writes on a collection used in tests
This commit is contained in:
committed by
Nick Martin
parent
74ad9390db
commit
556aba22ac
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user