<commit_before># vim:fileencoding=utf-8
require_relative 'test_helper'

context 'Cli' do
  def mock_runtime_env
    mock.tap { |m| m.stubs(:setup) }
  end

  def new_cli(argv = [], env = {})
    Resque::Scheduler::Cli.new(argv, env).tap do |cli|
      cli.stubs(:runtime_env).returns(mock_runtime_env)
    end
  end

  test 'does not require any positional arguments' do
    assert(!new_cli.nil?)
  end

  test 'initializes verbose from the env' do
    cli = new_cli([], 'VERBOSE' => 'foo')
    assert_equal('foo', cli.send(:options)[:verbose])
  end

  test 'defaults to non-verbose' do
    assert_equal(false, !!new_cli.send(:options)[:verbose])
  end

  test 'accepts verbose via -v' do
    cli = new_cli(%w(-v))
    cli.parse_options
    assert_equal(true, cli.send(:options)[:verbose])
  end<commit_msg>Assert cli version behavior<commit_after># vim:fileencoding=utf-8
require_relative 'test_helper'

context 'Cli' do
  def mock_runtime_env
    mock.tap { |m| m.stubs(:setup) }
  end

  def new_cli(argv = [], env = {})
    Resque::Scheduler::Cli.new(argv, env).tap do |cli|
      cli.stubs(:runtime_env).returns(mock_runtime_env)
    end
  end

  test 'does not require any positional arguments' do
    assert(!new_cli.nil?)
  end

  test 'sets the version on the option parser' do
    cli = new_cli
    assert_equal(Resque::Scheduler::VERSION, cli.send(:option_parser).version)
  end

  test 'initializes verbose from the env' do
    cli = new_cli([], 'VERBOSE' => 'foo')
    assert_equal('foo', cli.send(:options)[:verbose])
  end

  test 'defaults to non-verbose' do
    assert_equal(false, !!new_cli.send(:options)[:verbose])
  end

  test 'accepts verbose via -v' do
    cli = new_cli(%w(-v))
    cli.parse_options
    assert_equal(true, cli.send(:options)[:verbose])
  end
{'fraction_non_alphanumeric': 0.1384529147982063, 'fraction_numerical': 0.0011210762331838565, 'mean_word_length': 3.877049180327869, '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': '4286479', 'n_tokens_mistral': 653, 'n_tokens_neox': 620, 'n_words': 150}