<commit_before>var helpers = require("yeoman-generator").test;
var assert  = require("assert");
var path    = require("path");
var shelljs = require("shelljs");
var yaml    = require("js-yaml");
var fs      = require("fs");
var assert  = require("chai").assert;
var sinon   = require("sinon");

describe("incubator travis generator", function () {
	var testDirectory = path.join(__dirname, "temp");
	var testTravisYml = path.join(testDirectory, ".travis.yml");
	var app;

	var props = {
		nodeVersions        : [ "0.10", "0.11" ],
		npmRegistryApiToken : "<PASSWORD>"
	};

	beforeEach(function (done) {
		sinon.stub(shelljs, "exec")
			.withArgs(
				"travis encrypt NPM_API_TOKEN=" + props.npmRegistryApiToken,
				{ silent : false }
			)
			.returns("\"9SD8F9SD8F9S8DF9SD8F9SD8FJLKSDJFLSKDJF\"")
			.withArgs("git remote -v", { silent : true })
			.returns({ code : 0 });

		sinon.stub(shelljs, "which")
			.withArgs("travis")
			.returns(true);

		helpers.testDirectory(testDirectory, function (err) {
			if (err) {
				return done(err);
			}

			app = helpers.createGenerator("incubator:travis", [
				"../../travis"
			]);

			done();
		});
	});

	afterEach(function (done) {
		shelljs.exec.restore();
		shelljs.which.restore();

		done();
	});

	it("can be imported without blowing up", function (done) {
		var app = require("../travis");
		assert(app !== undefined, "result of a require should not be undefined");

		done();
	});

	it("creates a .travis.yml config file", function (done) {
		helpers.mockPrompt(app, props);

		app.run({}, function () {
			assert(shelljs.test("-f", testTravisYml), "no .travis.yml found");
			done();
		});
	});

	it("creates a .travis.yml config file with proper defaults", function (done) {<commit_msg>Changes suggested by Jeff<commit_after>var helpers = require("yeoman-generator").test;
var path    = require("path");
var shelljs = require("shelljs");
var yaml    = require("js-yaml");
var fs      = require("fs");
var assert  = require("chai").assert;
var sinon   = require("sinon");

describe("incubator travis generator", function () {
	var testDirectory = path.join(__dirname, "temp");
	var testTravisYml = path.join(testDirectory, ".travis.yml");
	var app;

	var props = {
		nodeVersions        : [ "0.10", "0.11" ],
		npmRegistryApiToken : "<PASSWORD>"
	};

	beforeEach(function (done) {
		sinon.stub(shelljs, "exec")
			.withArgs(
				"travis encrypt NPM_API_TOKEN=" + props.npmRegistryApiToken,
				{ silent : false }
			)
			.returns("\"9SD8F9SD8F9S8DF9SD8F9SD8FJLKSDJFLSKDJF\"")
			.withArgs("git remote -v", { silent : true })
			.returns({ code : 0 });

		sinon.stub(shelljs, "which")
			.withArgs("travis")
			.returns(true);

		helpers.testDirectory(testDirectory, function (err) {
			if (err) {
				return done(err);
			}

			app = helpers.createGenerator("incubator:travis", [
				"../../travis"
			]);

			done();
		});
	});

	afterEach(function () {
		shelljs.exec.restore();
		shelljs.which.restore();
	});

	it("can be imported without blowing up", function () {
		var app = require("../travis");
		assert(app !== undefined, "result of a require should not be undefined");
	});

	it("creates a .travis.yml config file", function (done) {
		helpers.mockPrompt(app, props);

		app.run({}, function () {
			assert(shelljs.which.called);
			assert(shelljs.exec.called);
			assert(shelljs.test("-f", testTravisYml), "no .travis.yml found");

			done();
		});
	});

	it("creates a .travis.yml config file with proper defaults", function (done) {
{'fraction_non_alphanumeric': 0.17699115044247787, 'fraction_numerical': 0.009705966314587497, 'mean_word_length': 3.735135135135135, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7436730', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1230, 'n_words': 266}