<commit_before>require 'spec_helper'
require 'contao/generators/application'

module TechnoGate
  module Contao
    module Generators
      describe Application do
        let(:klass) { Application }
        subject {
          Application.new path: @path
        }

        before :each do
          @path = '/root/my_awesome_project'
        end

        it_should_behave_like "Generator"

        describe "#generate" do
          before :each do
            klass.any_instance.stub :clone_template
            klass.any_instance.stub :rename_project
            klass.any_instance.stub :run_bundle_install
            klass.any_instance.stub :commit_everything
            klass.any_instance.stub :replace_origin_with_template
            System.stub(:system)
          end

          it "should have the following call stack" do
            subject.should_receive(:clone_template).once.ordered
            subject.should_receive(:rename_project).once.ordered
            subject.should_receive(:run_bundle_install).once.ordered
            subject.should_receive(:commit_everything).once.ordered
            subject.should_receive(:replace_origin_with_template).once.ordered

            subject.generate
          end
        end

        describe "#clone_template" do
          it {should respond_to :clone_template}

          it "should clone the repository to path provided to the initializer" do
            System.should_receive(:system).with(
              'git',
              'clone',
              '--recursive',
              Application::REPO_URL,
              @path
            ).once.and_return true

            subject.send :clone_template
          end
        end

        describe "#rename_project", :fakefs do
          before :each do
            stub_filesystem!(:application_name => 'contao_template')
          end

          it {should respond_to :rename_project}

          it "should rename the application" do
            subject.send :rename_project

            File.read('/root/my_awesome_project/config/application.rb').should =~
              /config\.application_name\s+=\s+'my_awesome_project'/
          end
        end

        describe "#run_bundle_install", :fakefs do
          before :each do
            stub_filesystem!
          end

          it {should respond_to :run_bundle_install}

          it "should change the folder to the path" do
            Dir.should_receive(:chdir).once

            subject.send :run_bundle_install
          end<commit_msg>Fix a failing spec<commit_after>require 'spec_helper'
require 'contao/generators/application'

module TechnoGate
  module Contao
    module Generators
      describe Application do
        let(:klass) { Application }
        subject {
          Application.new path: @path
        }

        before :each do
          @path = '/root/my_awesome_project'
        end

        it_should_behave_like "Generator"

        describe "#generate" do
          before :each do
            klass.any_instance.stub :clone_template
            klass.any_instance.stub :rename_project
            klass.any_instance.stub :run_bundle_install
            klass.any_instance.stub :commit_everything
            klass.any_instance.stub :replace_origin_with_template
            System.stub(:system)
          end

          it "should have the following call stack" do
            subject.should_receive(:clone_template).once.ordered
            subject.should_receive(:rename_project).once.ordered
            subject.should_receive(:run_bundle_install).once.ordered
            subject.should_receive(:commit_everything).once.ordered
            subject.should_receive(:replace_origin_with_template).once.ordered

            subject.generate
          end
        end

        describe "#clone_template" do
          it {should respond_to :clone_template}

          it "should clone the repository to path provided to the initializer" do
            System.should_receive(:system).with(
              'git',
              'clone',
              '--recursive',
              Application::REPO_URL,
              @path
            ).once.and_return true

            subject.send :clone_template
          end
        end

        describe "#rename_project", :fakefs do
          before :each do
            stub_filesystem!(:application_name => 'contao_template')
          end

          it {should respond_to :rename_project}

          it "should rename the application" do
            subject.send :rename_project

            File.read('/root/my_awesome_project/config/application.rb').should =~
              /config\.contao\.application_name\s+=\s+'my_awesome_project'/
          end
        end

        describe "#run_bundle_install", :fakefs do
          before :each do
            stub_filesystem!
          end

          it {should respond_to :run_bundle_install}

          it "should change the folder to the path" do
            Dir.should_receive(:chdir).once

            subject.send :run_bundle_install
          end
{'fraction_non_alphanumeric': 0.0727489564698867, 'fraction_numerical': 0.0, 'mean_word_length': 1.8986175115207373, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5387419', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1287, 'n_words': 290}