<commit_before>require "spec_helper"

describe Alloy::Core::RunOnce do
  before(:all) { @model = Test::Alloy::Core::RunOnce }

  it { @model.should allow_public_access_for_methods :run_once }

  describe ".run_once" do
    it "should execute the the specified job once" do
      job_clazz = Test::Alloy::Job::Capability

      job_instance = job_clazz.new
      job_instance.should_receive(:execute).once

      @model.should_receive(:limit).and_return 1
      @model.should_receive(:create_job_instance).and_return job_instance

      @model.run_once :queue, job_clazz
    end
<commit_msg>Add future invoke to wait for execution.<commit_after>require "spec_helper"

describe Alloy::Core::RunOnce do
  before(:all) { @model = Test::Alloy::Core::RunOnce }

  it { @model.should allow_public_access_for_methods :run_once }

  describe ".run_once" do
    it "should execute the the specified job once" do
      job_clazz = Test::Alloy::Job::Capability

      job_instance = job_clazz.new
      job_instance.should_receive(:execute).once

      @model.should_receive(:limit).and_return 1
      @model.should_receive(:create_job_instance).and_return job_instance

      future = @model.run_once :queue, job_clazz
      future.get
    end

{'fraction_non_alphanumeric': 0.1030008110300081, 'fraction_numerical': 0.0016220600162206002, 'mean_word_length': 4.184873949579832, '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': '634017', 'n_tokens_mistral': 404, 'n_tokens_neox': 383, 'n_words': 82}