/*global describe, beforeEach, it */
'use strict';
var path = require('path');
var helpers = require('yeoman-generator').test;

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

            this.repo = helpers.createGenerator('element:repo', [
                '../../repo'
            ]);

            done();
        }.bind(this));
    });

    it('creates expected files', function (done) {
        var expected = [
            '.editorconfig',
            '.gitignore',
            'bower.json',
            'package.json',
            'index.html',
            'Gruntfile.js',
            'README.md',
            'src/my-element.html'
        ];

        helpers.mockPrompt(this.repo, {
            'githubRepo': 'my-user',
            'githubUser': 'my-repo',
            'elementName': 'my-element',
            'elementDescription': 'My awesome Custom Element',
            'lifecycle': true,
            'grunt': true
        });

        this.repo.options['skip-install'] = true;

        this.repo.run({}, function () {
            helpers.assertFile(expected);
            done();
        });
    });

    it('creates expected files when there\'s no grunt tasks included', function (done) {
        var expected = [
            '.editorconfig',
            '.gitignore',
            'bower.json',
            'index.html',
            'README.md',
            'src/my-element.html'
        ];

        helpers.mockPrompt(this.repo, {
            'githubRepo': 'my-user',
            'githubUser': 'my-repo',
            'elementName': 'my-element',
            'elementDescription': 'My awesome Custom Element',
            'lifecycle': false,
            'grunt': false
        });

        this.repo.options['skip-install'] = true;

        this.repo.run({}, function () {
            helpers.assertFile(expected);
            done();
        });
    });
});

@@ -30,16 +30,17 @@
 , it */%0A
+%0A
 'use str
@@ -45,16 +45,17 @@
 trict';%0A
+%0A
 var path
@@ -366,20 +366,19 @@
    this.
-repo
+app
  = helpe
@@ -405,20 +405,19 @@
 element:
-repo
+app
 ', %5B%0A   
@@ -436,20 +436,19 @@
  '../../
-repo
+app
 '%0A      
@@ -603,503 +603,115 @@
    '
-.editorconfig',%0A            '.gitignore',%0A            'bower.json',%0A            'package.json',%0A            'index.html',%0A            'Gruntfile.js',%0A            'README.md',%0A            'src/my-element.html'%0A        %5D;%0A%0A        helpers.mockPrompt(this.repo, %7B%0A            'githubRepo': 'my-user',%0A            'githubUser': 'my-repo',%0A            'elementName': 'my-element',%0A            'elementDescription': 'My awesome Custom Element',%0A            'lifecycle': true,%0A            'grunt': true
+my-element.html'%0A        %5D;%0A%0A        helpers.mockPrompt(this.app, %7B%0A            'elementName': 'my-element'
 %0A   
@@ -725,36 +725,35 @@
 ;%0A%0A        this.
-repo
+app
 .options%5B'skip-i
@@ -761,33 +761,32 @@
 stall'%5D = true;%0A
-%0A
         this.rep
@@ -786,768 +786,11 @@
 his.
-repo.run(%7B%7D, function () %7B%0A            helpers.assertFile(expected);%0A            done();%0A        %7D);%0A    %7D);%0A%0A    it('creates expected files when there%5C's no grunt tasks included', function (done) %7B%0A        var expected = %5B%0A            '.editorconfig',%0A            '.gitignore',%0A            'bower.json',%0A            'index.html',%0A            'README.md',%0A            'src/my-element.html'%0A        %5D;%0A%0A        helpers.mockPrompt(this.repo, %7B%0A            'githubRepo': 'my-user',%0A            'githubUser': 'my-repo',%0A            'elementName': 'my-element',%0A            'elementDescription': 'My awesome Custom Element',%0A            'lifecycle': false,%0A            'grunt': false%0A        %7D);%0A%0A        this.repo.options%5B'skip-install'%5D = true;%0A%0A        this.repo
+app
 .run

Test only "yo element:app" for now