Last active
November 9, 2015 23:11
-
-
Save tdouce/4637822b37cf09191be6 to your computer and use it in GitHub Desktop.
remote_factory_girl and remote_database_cleaner js implementation
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
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