Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Why -restCreate, -restUpdate and -restDelete are removed from canjs fixtures

$
0
0
Because you can now easily do that with can.fixture.store:

  1. var todoStore = can.fixture.store(100, function(i){
  2.   return {
  3.     id: i,
  4.     name: "todo number "+i,
  5.     description: "a description of some todo",
  6.     ownerId: can.fixture.rand(10)
  7.   }
  8. });

  9. can.fixture({
  10.   'GET /todos':         todoStore.findAll,
  11.   'GET /todos/{id}':    todoStore.findOne,
  12.   'POST /todos':        todoStore.create,
  13.   'PUT /todos/{id}':    todoStore.update,
  14.   'DELETE /todos/{id}': todoStore.destroy
  15. });
The advantage is that you don't have to add fixture information to your actual AJAX call. You can just put it wherever and include it only when testing.

Viewing all articles
Browse latest Browse all 3491

Trending Articles