<commit_before>require 'spec_helper'
require 'guard/interactors/readline'

describe Guard::ReadlineInteractor do
  subject { Guard::ReadlineInteractor.new }

  describe "#initialize" do
    # completion_proc getter is not implemented in JRuby
    # see https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/Readline.java#L349
    if RUBY_PLATFORM != 'java'
      it 'sets the Readline completion proc' do
        subject
        Readline.completion_proc.should be_a Proc
      end
    end
  end

  describe '#start' do
    it 'stores the terminal settings' do
      subject.should_receive(:store_terminal_settings)
      subject.start
    end
  end

  describe '#stop' do
    before { Thread.stub(:current).and_return(nil) }

    it 'restores the terminal settings' do<commit_msg>Fix the Readline interactor spec on rubinius<commit_after>require 'spec_helper'
require 'guard/interactors/readline'

describe Guard::ReadlineInteractor do
  subject { Guard::ReadlineInteractor.new }

  describe "#initialize" do
    # completion_proc getter is not implemented in JRuby
    # see https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/Readline.java#L349
    if RUBY_PLATFORM != 'java'
      it 'sets the Readline completion proc' do
        subject
        Readline.completion_proc.should be_a Proc
      end
    end
  end

  describe '#start' do
    it 'stores the terminal settings' do
      subject.should_receive(:store_terminal_settings)
      subject.start
    end
  end

  describe '#stop' do
    before { subject.instance_variable_set(:@thread, Thread.current) }

    it 'restores the terminal settings' do
{'fraction_non_alphanumeric': 0.08379544054220579, 'fraction_numerical': 0.0036968576709796672, 'mean_word_length': 3.4371584699453552, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1773924', 'n_tokens_mistral': 518, 'n_tokens_neox': 482, 'n_words': 130}