Skip to content

Instantly share code, notes, and snippets.

View DannyDouglass's full-sized avatar

Danny Douglass DannyDouglass

View GitHub Profile
def replaceFileContents( path, patternToReplace, newProjectName )
fileContents = File.read ( path )
fileContents = fileContents.gsub( patternToReplace, newProjectName )
File.open( path, 'w' ) { | file | file.puts fileContents }
end
def packageInitiator( startDirectory, patternToReplace, newProjectName )
directoryItems = Dir.glob( startDirectory ).reverse
directoryItems.each do | path |
# ignoring ruby scripts so I don't change contents of this file
@DannyDouglass
DannyDouglass / GithubApiTestWithNock
Created August 23, 2013 19:59
Simple api mock test against github enterprise api to create a new repository
describe('POST to Github API to create new repository with answers', function() {
it('should return an HTTP Status 201 Completed', function() {
var fakeAnswers = {
githubRepoName: 'test-repo',
githubOrganization: 'test-organization'
};
var githubMock = nock('http://github.nreca.org')
.post('/api/v3/orgs/' + fakeAnswers.githubOrganization + '/repos', fakeAnswers)