Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tdouce/4637822b37cf09191be6 to your computer and use it in GitHub Desktop.
Save tdouce/4637822b37cf09191be6 to your computer and use it in GitHub Desktop.
remote_factory_girl and remote_database_cleaner js implementation
function remoteFactoryGirl(factoryName, attributes) {
var attributes = attributes || {};
var end_point = 'http://localhost:4000/remote_factory_girl/home';
var json;
$.ajax({
async: false,
url: end_point,
type: 'POST',
data: { factory: factoryName,
attributes: attributes },
success: function(response) {
json = response;
}
});
return json;
};
function remoteDatabaseCleaner() {
var end_point = 'http://localhost:4000/remote_database_cleaner/home/clean';
var json;
$.ajax({
async: false,
url: end_point,
type: 'POST',
success: function(response) {
json = response;
}
});
return json;
};
remoteFactoryGirl('school_with_principal', { name: 'Northside' });
remoteDatabaseCleaner();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment