<commit_before># encoding: utf-8

require 'singularity_dsl/cli/command/app_runner_command'

describe SingularityDsl::Cli::Command::AppRunnerCommand do
  let(:cmd) { SingularityDsl::Cli::Command::AppRunnerCommand.new }

  describe '#initialize_app' do
    context 'no script given' do
      it 'fails' do
        expect { cmd.initialize_app }.to raise_error(/Invalid script/)
      end
    end

    context 'a script is given' do
      let(:script) { 'path/to/a/singularity/script' }
      let(:cfg) { { script: script } }
      let(:cmd) do
        SingularityDsl::Cli::Command::AppRunnerCommand.new cfg
      end

      context 'and it is an invalid path' do
        before :each do
          allow(::File).to receive(:exist?).with(script).and_return false
        end

        it 'fails' do
          expect { cmd.initialize_app }.to raise_error(/Invalid script/)
        end
      end
    end
  end
end<commit_msg>app_runner_command_spec: make ::File.exist? return false for everything<commit_after># encoding: utf-8

require 'singularity_dsl/cli/command/app_runner_command'

describe SingularityDsl::Cli::Command::AppRunnerCommand do
  let(:cmd) { SingularityDsl::Cli::Command::AppRunnerCommand.new }

  describe '#initialize_app' do
    context 'no script given' do
      it 'fails' do
        expect { cmd.initialize_app }.to raise_error(/Invalid script/)
      end
    end

    context 'a script is given' do
      let(:script) { 'path/to/a/singularity/script' }
      let(:cfg) { { script: script } }
      let(:cmd) do
        SingularityDsl::Cli::Command::AppRunnerCommand.new cfg
      end

      context 'and it is an invalid path' do
        before :each do
          # TODO: this may be indicative of a must larger problem...
          allow(::File).to receive(:exist?).and_return false
        end

        it 'fails' do
          expect { cmd.initialize_app }.to raise_error(/Invalid script/)
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10728952772073921, 'fraction_numerical': 0.001026694045174538, 'mean_word_length': 2.726577437858509, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2140491', 'n_tokens_mistral': 608, 'n_tokens_neox': 584, 'n_words': 159}