<commit_before>require 'spec_helper'

describe SpicedGracken::CLI::Ping do
  let (:klass){ SpicedGracken::CLI::Ping }

  before(:each) do
    mock_settings_objects
  end

  describe '#handle' do
    it 'cannot find the server' do
      c = klass.new('/ping alias noone')
      expect(c.handle).to eq ('noone could not be found')
    end

    it 'shows usage' do
      c = klass.new('/ping')
      expect(c.handle).to eq c.usage
    end
  end

  describe '#lookup_field' do
    it 'is the subcommand' do
      c = klass.new('/ping alias')
      expect(c.lookup_field).to eq c.send(:sub_command)
    end
<commit_msg>increase coverage<commit_after>require 'spec_helper'

describe SpicedGracken::CLI::Ping do
  let (:klass){ SpicedGracken::CLI::Ping }

  before(:each) do
    mock_settings_objects
  end

  describe '#handle' do
    before(:each) do
      allow(SpicedGracken::Http::Client).to receive(:send_to_and_close){}
    end

    it 'cannot find the server' do
      c = klass.new('/ping alias noone')
      expect(c.handle).to eq ('noone could not be found')
    end

    it 'shows usage' do
      c = klass.new('/ping')
      expect(c.handle).to eq c.usage
    end

    it 'tries to send' do
      c = klass.new('/ping address noone')
      # does not return when sending
      expect(c.handle).to eq nil
    end
  end

  describe '#lookup_field' do
    it 'is the subcommand' do
      c = klass.new('/ping alias')
      expect(c.lookup_field).to eq c.send(:sub_command)
    end

{'fraction_non_alphanumeric': 0.12061994609164421, 'fraction_numerical': 0.0, 'mean_word_length': 2.8076923076923075, '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': '232200', 'n_tokens_mistral': 515, 'n_tokens_neox': 506, 'n_words': 144}