-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
4,548 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
/node_modules | ||
/vendor/* | ||
!/vendor/loader.js | ||
!/vendor/sinon.js | ||
|
||
# misc | ||
/.sass-cache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,63 @@ | ||
module.exports = function(server) { | ||
|
||
// Create an API namespace, so that the root does not | ||
// Create an API namespace, so that the root does not | ||
// have to be repeated for each end point. | ||
server.namespace('/api', function() { | ||
|
||
// Return fixture data for '/api/posts/:id' | ||
server.get('/posts/:id', function(req, res) { | ||
var post = { | ||
"post": { | ||
"id": 1, | ||
"title": "Rails is omakase", | ||
"comments": ["1", "2"], | ||
"user" : "dhh" | ||
}, | ||
server.get('/mailboxes/', function(req, res) { | ||
|
||
"comments": [{ | ||
"id": "1", | ||
"body": "Rails is unagi" | ||
}, { | ||
"id": "2", | ||
"body": "Omakase O_o" | ||
}] | ||
}; | ||
var data = { | ||
"mailboxes": [{ | ||
"name": "Inbox", | ||
"id": "inbox", | ||
"messages": ["1", "2"] | ||
}, { | ||
"name": "Spam", | ||
"id": "spam", | ||
"messages": ["3"] | ||
}, { | ||
"name": "Sent Mail", | ||
"id": "sent-mail", | ||
"messages": ["4"] | ||
}], | ||
|
||
res.send(post); | ||
"messages": [{ | ||
"id": 1, | ||
"subject": "Welcome to Ember", | ||
"from": "[email protected]", | ||
"to": "[email protected]", | ||
"date": new Date(), | ||
"body": "Welcome to Ember. We hope you enjoy your stay" | ||
}, { | ||
"id": 2, | ||
"subject": "Great Ember Resources", | ||
"from": "[email protected]", | ||
"to": "[email protected]", | ||
"date": new Date(), | ||
"body": "Have you seen embercasts.com? How about emberaddons.com?" | ||
}, | ||
{ | ||
"id": 3, | ||
"subject": "You have one the lottery!!!111ONEONE", | ||
"from": "[email protected]", | ||
"to": "[email protected]", | ||
"date": new Date(), | ||
"body": "You have ONE the lottery! You only have to send us a small amount of monies to claim your prize" | ||
}, | ||
{ | ||
"id": 4, | ||
"subject": "Should I use Ember", | ||
"from": "[email protected]", | ||
"to": "[email protected]", | ||
"date": new Date(), | ||
"body": "Ember looks pretty good, should I use it?" | ||
}] | ||
}; | ||
|
||
res.send(data); | ||
}); | ||
|
||
}); | ||
|
||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
export default DS.FixtureAdapter.extend(); | ||
// Application adapter | ||
// =================== | ||
|
||
var ApplicationAdapter = DS.RESTAdapter.extend({ | ||
namespace: 'api' | ||
}); | ||
|
||
export default ApplicationAdapter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,15 @@ | ||
// Mailbox model | ||
// ============= | ||
|
||
var Mailbox = Em.Object.extend(); | ||
var attr = DS.attr, | ||
hasMany = DS.hasMany; | ||
|
||
Mailbox.reopenClass({ | ||
find: function(id) { | ||
if (id) { | ||
return FIXTURES.findBy('id', id); | ||
} else { | ||
console.log(FIXTURES); | ||
return FIXTURES; | ||
} | ||
} | ||
var Mailbox = DS.Model.extend({ | ||
number: attr(), | ||
name: attr(), | ||
messages: hasMany('message') | ||
}); | ||
|
||
export default Mailbox; | ||
Mailbox.idField = 'number'; | ||
|
||
var FIXTURES = [ | ||
{ | ||
name: "Inbox", | ||
id: "inbox", | ||
messages: [ | ||
{ | ||
id: 1, | ||
subject: "Welcome to Ember", | ||
from: "[email protected]", | ||
to: "[email protected]", | ||
date: new Date(), | ||
body: "Welcome to Ember. We hope you enjoy your stay" | ||
}, { | ||
id: 2, | ||
subject: "Great Ember Resources", | ||
from: "[email protected]", | ||
to: "[email protected]", | ||
date: new Date(), | ||
body: "Have you seen embercasts.com? How about emberaddons.com?" | ||
} | ||
] | ||
}, { | ||
name: "Spam", | ||
id: "spam", | ||
messages: [ | ||
{ | ||
id: 3, | ||
subject: "You have one the lottery!!!111ONEONE", | ||
from: "[email protected]", | ||
to: "[email protected]", | ||
date: new Date(), | ||
body: "You have ONE the lottery! You only have to send us a small amount of monies to claim your prize" | ||
} | ||
] | ||
}, { | ||
name: "Sent Mail", | ||
id: "sent-mail", | ||
messages: [ | ||
{ | ||
id: 4, | ||
subject: "Should I use Ember", | ||
from: "[email protected]", | ||
to: "[email protected]", | ||
date: new Date(), | ||
body: "Ember looks pretty good, should I use it?" | ||
} | ||
] | ||
} | ||
]; | ||
export default Mailbox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Message model | ||
// ============= | ||
|
||
var attr = DS.attr; | ||
|
||
var Message = DS.Model.extend({ | ||
number: attr(), | ||
subject: attr(), | ||
from: attr(), | ||
to: attr(), | ||
date: attr(), | ||
body: attr() | ||
}); | ||
|
||
Message.idField = 'number'; | ||
|
||
export default Message; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
var App; | ||
// var App; | ||
|
||
module('Acceptances - Component', { | ||
setup: function(){ | ||
App = startApp(); | ||
}, | ||
teardown: function() { | ||
Ember.run(App, 'destroy'); | ||
} | ||
}); | ||
|
||
test('component output is rendered', function(){ | ||
expect(2); | ||
|
||
visit('/component-test').then(function(){ | ||
var list = find('.pretty-color'); | ||
equal(list.length, 3); | ||
equal(list.first().text(), 'Pretty Color: purple\n'); | ||
}); | ||
}); | ||
// module('Acceptances - Component', { | ||
// setup: function(){ | ||
// App = startApp(); | ||
// }, | ||
// teardown: function() { | ||
// Ember.run(App, 'destroy'); | ||
// } | ||
// }); | ||
// test('component output is rendered', function(){ | ||
// expect(2); | ||
// visit('/component-test').then(function(){ | ||
// var list = find('.pretty-color'); | ||
// equal(list.length, 3); | ||
// equal(list.first().text(), 'Pretty Color: purple\n'); | ||
// }); | ||
// }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
var App; | ||
// var App; | ||
|
||
module("Acceptances - Helper", { | ||
setup: function(){ | ||
App = startApp(); | ||
}, | ||
teardown: function() { | ||
Ember.run(App, 'destroy'); | ||
} | ||
}); | ||
// module("Acceptances - Helper", { | ||
// setup: function(){ | ||
// App = startApp(); | ||
// }, | ||
// teardown: function() { | ||
// Ember.run(App, 'destroy'); | ||
// } | ||
// }); | ||
|
||
test("helper output is rendered", function(){ | ||
expect(1); | ||
// test("helper output is rendered", function(){ | ||
// expect(1); | ||
|
||
visit('/helper-test').then(function(){ | ||
ok(exists("h3:contains('My name is Ember.')")); | ||
}); | ||
}); | ||
// visit('/helper-test').then(function(){ | ||
// ok(exists("h3:contains('My name is Ember.')")); | ||
// }); | ||
// }); | ||
|
Oops, something went wrong.