Skip to content

Instantly share code, notes, and snippets.

@oliverbarnes
Last active August 29, 2015 14:17
Show Gist options
  • Save oliverbarnes/b1fba693da6215586589 to your computer and use it in GitHub Desktop.
Save oliverbarnes/b1fba693da6215586589 to your computer and use it in GitHub Desktop.
test not loading
var get = Ember.get, set = Ember.set;
var models, env;
var responses, fakeServer;
module('integration/specs/errors', {
setup: function() {
fakeServer = stubServer();
responses = {
post_errors: {
errors: [
{
code: "blank",
title: "First Name cannot be blank", // we won't actually use that I guess as we want to have the translations on the client
paths: ["/first-name"]
},
{
code: "blank",
title: "Last Name cannot be blank", // we won't actually use that I guess as we want to have the translations on the client
paths: ["/last-name"]
},
{
code: "too-short",
title: "Password mist have at least 8 characters", // we won't actually use that I guess as we want to have the translations on the client
paths: ["/password"]
}
]
}
};
models = setModels();
env = setupStore(models);
env.store.modelFor('post');
env.store.modelFor('comment');
},
teardown: function() {
Ember.run(env.store, 'destroy');
shutdownFakeServer(fakeServer);
}
});
asyncTest("PUT /posts/1 returns errors", function() {
var request = {
posts: {
id: '1',
title: '',
first-name: '',
password: ''
}
};
fakeServer.put('/posts/1', request, responses.post_errors);
Em.run(function() {
env.store.find('post', '1').then(function(post) {
console.log(post);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment