var path    = require('path');
var helpers = require('yeoman-generator').test;

describe('generator-component', function() {
  beforeEach(function(done) {
    helpers.testDirectory(path.join(__dirname, 'temp'), function(err) {
      if (err) {
        return done(err);
      }

      this.app = helpers.createGenerator('component:app', [
        '../../app'
      ]);
      done();
    }.bind(this));
  });

  it('creates basic files', function(done) {
    var expected = [
      '.gitignore',
      '.gitattributes',
      'component.json',
      'index.js',
      ['package.json', /"name": "temp"/],
      'README.md'
    ];

    helpers.mockPrompt(this.app, {
      'editorConfig': 'N'
    });

    this.app.run({}, function() {
      helpers.assertFiles(expected);
      done();
    });
  });

  it('creates extra files', function(done) {
    var expected = [
      '.editorconfig',
      '.gitignore',
      '.gitattributes',
      'component.json',
      'index.js',
      ['package.json', /"name": "temp"/],
      'README.md'
    ];

    helpers.mockPrompt(this.app, {
      'editorConfig': 'Y'
    });

    this.app.run({}, function() {
      helpers.assertFiles(expected);
      done();
    });
  });
});
@@ -471,38 +471,42 @@
  = %5B%0A      '.git
-ignore
+attributes
 ',%0A      '.gitat
@@ -499,34 +499,50 @@
 %0A      '.git
-attributes
+ignore',%0A      'HISTORY.md
 ',%0A      'co
@@ -904,38 +904,42 @@
 ig',%0A      '.git
-ignore
+attributes
 ',%0A      '.gitat
@@ -932,34 +932,50 @@
 %0A      '.git
-attributes
+ignore',%0A      'HISTORY.md
 ',%0A      'co

Test for HISTORY.md