<commit_before>require 'test_helper'

require 'resque/cli'

describe Resque::CLI do
  describe "#work" do
    it "does its thing" do
      worker = MiniTest::Mock.new.expect(:work, "did some work!")

      Resque::Worker.stub(:new, worker) do
        cli = Resque::CLI.new([], ["-c", "test/fixtures/resque.yml", "-i", "666", "-q", "first,second", "-r", "path/to/file"])
        assert_equal "did some work!", cli.invoke(:work)
      end
    end
  end

  describe "#list" do
    describe "no workers" do
      it "displays None" do
        cli = Resque::CLI.new([], ["-c", "test/fixtures/resque.yml", "--redis", "localhost:6379/resque"])

        Resque::WorkerRegistry.stub(:all, []) do
          out, _ = capture_io do
            cli.invoke(:list)
          end

          assert_equal "None", out.chomp
        end
      end
    end

    describe "with a worker" do
      it "displays worker state" do
        Resque::WorkerRegistry.stub(:all, [MiniTest::Mock.new.expect(:state, "working")]) do

          cli = Resque::CLI.new([], ["-c", "test/fixtures/resque.yml", "--redis", "localhost:6379/resque"])
          out, _ = capture_io do
            cli.invoke(:list)
          end

          assert_match(/\(working\)/, out.chomp)
        end
      end
    end
  end
end<commit_msg>Fix test_helper dependency, clean up test.<commit_after>require File.join(File.expand_path(File.dirname(__FILE__)), 'test_helper')

require 'resque/cli'

describe Resque::CLI do
  describe "#work" do
    it "does its thing" do
      Resque::Worker.stub(:new, MiniTest::Mock.new.expect(:work, "did some work!")) do
        cli = Resque::CLI.new
        assert_equal "did some work!", cli.invoke(:work)
      end
    end
  end

  describe "#list" do
    describe "no workers" do
      it "displays None" do
        Resque::WorkerRegistry.stub(:all, []) do
          cli = Resque::CLI.new
          out, _ = capture_io { cli.invoke(:list) }
          assert_equal "None", out.chomp
        end
      end
    end

    describe "with a worker" do
      it "displays worker state" do
        Resque::WorkerRegistry.stub(:all, [MiniTest::Mock.new.expect(:state, "working")]) do
          cli = Resque::CLI.new
          out, _ = capture_io { cli.invoke(:list) }
          assert_match(/\(working\)/, out.chomp)
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.1481322455989695, 'fraction_numerical': 0.0047230571060541005, 'mean_word_length': 2.3719247467438493, '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': '3793232', 'n_tokens_mistral': 798, 'n_tokens_neox': 771, 'n_words': 189}