Skip to content

Commit

Permalink
fix: access to newData root
Browse files Browse the repository at this point in the history
WIP

fix goldibex#121
  • Loading branch information
dinoboff committed Feb 22, 2017
1 parent 381b68a commit 924b9ee
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/spec/lib/database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,23 @@ describe('database', function() {
expect(db.write('/a', 2).allowed).to.be.false();
});

it('should fix 121', function() {
const rules = {
rules: {
users: {},
groups: {
$groupId: {
'.write': 'newData.parent().parent().child("users").child(auth.uid).exists()'
}
}
}
};
const data = {users: {bob: true}};
const db = database.create(rules, data).as({uid: 'bob'}).with({debug: true});

expect(db.write('/groups/users', true).allowed).to.be.true();
});

});

describe('#update', function() {
Expand Down

0 comments on commit 924b9ee

Please sign in to comment.