Skip to content
This repository was archived by the owner on Apr 22, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test.js
node_modules
22 changes: 22 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = function (grunt) {
grunt.initConfig({
tape: {
options: {
pretty: false,
output: 'console'
},
files: ['test/**/*.js']
},
watch: {
files: ['./supermodel.js', 'test/**/*.js'],
tasks: ['tape'],
}
});
// Enable plugins
grunt.loadNpmTasks('grunt-tape');
grunt.loadNpmTasks('grunt-contrib-watch');
// register tasks
grunt.registerTask('test', ['tape']);
// default task
grunt.registerTask('default', ['test']);
};
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@ Please see [pathable.github.com/supermodel][supermodel] for documentation.

[supermodel]: http://pathable.github.com/supermodel
[ci]: https://ci.testling.com/pathable/supermodel


## How to contribute

* Fork this repository on GitHub
* Make sure you have [npm installed](https://www.npmjs.org/)
* Run `npm install` in the root directory
* Run the test suite with `grunt test`
* Write failing test
* Fix the test
* Submit a pull request
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"uglify-js": "~2.4.11",
"tape": "~2.4.2",
"browserify": "~3.23.1",
"faucet": "0.0.0"
"faucet": "0.0.0",
"grunt": "~0.4.5",
"grunt-tape": "0.0.2",
"grunt-contrib-watch": "~0.6.1"
},
"testling": {
"files": "test/*.js",
Expand Down
7 changes: 7 additions & 0 deletions test/has.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,13 @@ test('Many is initialized only once.', function(t) {
t.end();
});

test('has.One and has.Many should play nicly together', function(t) {
var user = User.create({id: 1});
var memberships = user.memberships().add({id: 1, user_id: 1})
t.is(user.memberships().length, 1);
t.end();
});

test('Source is removed after parsing.', function(t) {
var user = User.create();
user.parse({memberships: [{id: 1}, {id: 2, hidden: true}]});
Expand Down