<commit_before>class SuccessfulAction
  attr_writer :result

  def initialize(action_id)
    @action_id = action_id
    @result    = nil
  end

  def matches?(block)
    pusher.start
    thread = Thread.new { call block }
    sleep 1.0

    pusher.send 'completion', 'id' => action_id
    thread.join
    pusher.stop

    result
  end

  def failure_message_for_should
    "Action failed"
  end

  private

  attr_reader :action_id, :result

  def call(block)
    self.result = block.call
  end

  def pusher
    @pusher ||= LocalPusher.new
  end
end

module SuccessfulActionHelper
  def be_successful_with(action_id)
    SuccessfulAction.new action_id
  end
end

RSpec.configure do |config|
  config.include SuccessfulActionHelper
end<commit_msg>Sleep after closing external websocket server.<commit_after>class SuccessfulAction
  attr_writer :result

  def initialize(action_id)
    @action_id = action_id
    @result    = nil
  end

  def matches?(block)
    pusher.start
    thread = Thread.new { call block }
    sleep 1.0

    pusher.send 'completion', 'id' => action_id
    thread.join
    pusher.stop

    sleep 0.5

    result
  end

  def failure_message_for_should
    "Action failed"
  end

  private

  attr_reader :action_id, :result

  def call(block)
    self.result = block.call
  end

  def pusher
    @pusher ||= LocalPusher.new
  end
end

module SuccessfulActionHelper
  def be_successful_with(action_id)
    SuccessfulAction.new action_id
  end
end

RSpec.configure do |config|
  config.include SuccessfulActionHelper
end
{'fraction_non_alphanumeric': 0.06744487678339818, 'fraction_numerical': 0.0038910505836575876, 'mean_word_length': 3.136729222520107, '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': '5811087', 'n_tokens_mistral': 522, 'n_tokens_neox': 510, 'n_words': 130}