<commit_before>require 'spec_helper'
require 'stringio'
require 'json'

describe Resque::Plugins::Clues::EventPublisher do
  it "should pass Resque lint detection" do
    Resque::Plugin.lint(Resque::Plugins::Clues::EventPublisher) 
  end

  describe Resque::Plugins::Clues::EventPublisher::StandardOut do
    def verify_output_for_event_type(type)
      STDOUT.should_receive(:puts).with event_type: type.to_s,
                                        queue: :test_queue,
                                        metadata: {},
                                        worker_class: "FooBar",
                                        args: ["a", "b"]
    end

    def publish_event_type(type)
      @publisher.send(type, :test_queue, {}, "FooBar", "a", "b")
    end

    before do
      @publisher = Resque::Plugins::Clues::EventPublisher::StandardOut.new
    end

    it "should send enqueued event to STDOUT" do
      verify_output_for_event_type :enqueued
      publish_event_type :enqueued
    end

    it "should send dequeued event to STDOUT" do
      verify_output_for_event_type :dequeued
      publish_event_type :dequeued
    end

    it "should send perform_started event to STDOUT" do
      verify_output_for_event_type :perform_started
      publish_event_type :perform_started
    end

    it "should send perform_finished event to STDOUT" do
      verify_output_for_event_type :perform_finished
      publish_event_type :perform_finished
    end

    it "should send failed event to STDOUT" do
      verify_output_for_event_type :failed
      publish_event_type :failed
    end
  end
end
<commit_msg>Failing test for destroyed method of StandardOut event publisher<commit_after>require 'spec_helper'
require 'stringio'
require 'json'

describe Resque::Plugins::Clues::EventPublisher do
  it "should pass Resque lint detection" do
    Resque::Plugin.lint(Resque::Plugins::Clues::EventPublisher) 
  end

  describe Resque::Plugins::Clues::EventPublisher::StandardOut do
    def verify_output_for_event_type(type)
      STDOUT.should_receive(:puts).with event_type: type.to_s,
                                        queue: :test_queue,
                                        metadata: {},
                                        worker_class: "FooBar",
                                        args: ["a", "b"]
    end

    def publish_event_type(type)
      @publisher.send(type, :test_queue, {}, "FooBar", "a", "b")
    end

    before do
      @publisher = Resque::Plugins::Clues::EventPublisher::StandardOut.new
    end

    it "should send enqueued event to STDOUT" do
      verify_output_for_event_type :enqueued
      publish_event_type :enqueued
    end

    it "should send dequeued event to STDOUT" do
      verify_output_for_event_type :dequeued
      publish_event_type :dequeued
    end

    it "should send perform_started event to STDOUT" do
      verify_output_for_event_type :perform_started
      publish_event_type :perform_started
    end

    it "should send perform_finished event to STDOUT" do
      verify_output_for_event_type :perform_finished
      publish_event_type :perform_finished
    end

    it "should send failed event to STDOUT" do
      verify_output_for_event_type :failed
      publish_event_type :failed
    end

    it "should send destroyed event to STDOUT" do
      verify_output_for_event_type :destroyed
      publish_event_type :destroyed
    end
  end
end

{'fraction_non_alphanumeric': 0.06916764361078546, 'fraction_numerical': 0.0, 'mean_word_length': 2.6347177848775294, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3282031', 'n_tokens_mistral': 1023, 'n_tokens_neox': 971, 'n_words': 251}