<commit_before># coding: utf-8

require 'spec_helper'

RSpec.describe TTY::Screen, '.size' do
  let(:output) { StringIO.new('', 'w+') }

  subject(:screen) { described_class.new(output: output) }

  context 'size' do
    it "correctly falls through choices" do
      allow(screen).to receive(:from_io_console).and_return([51, 280])
      allow(screen).to receive(:from_readline).and_return(nil)
      expect(screen.size).to eq([51, 280])
      expect(screen).to_not have_received(:from_readline)
      expect(screen.width).to eq(280)
      expect(screen.height).to eq(51)
    end

    it "allows to call size as class instance" do
      screen = double(:screen, size: [51, 280])
      allow(TTY::Screen).to receive(:new).and_return(screen)
      expect(TTY::Screen.size).to eq([51, 280])
      expect(TTY::Screen.size).to eq([51, 280])
      expect(TTY::Screen.width).to eq(280)
      expect(TTY::Screen.height).to eq(51)
      expect(TTY::Screen).to have_received(:new).once
    end
  end

  context 'from io console' do
    it "doesn't calculate size if jruby " do
      allow(screen).to receive(:jruby?).and_return(true)
      expect(screen.from_io_console).to eq(nil)
    end
<commit_msg>Fix test.<commit_after># coding: utf-8

require 'spec_helper'

RSpec.describe TTY::Screen, '.size' do
  let(:output) { StringIO.new('', 'w+') }

  subject(:screen) { described_class.new(output: output) }

  context 'size' do
    it "correctly falls through choices" do
      allow(screen).to receive(:from_io_console).and_return([51, 280])
      allow(screen).to receive(:from_readline).and_return(nil)
      expect(screen.size).to eq([51, 280])
      expect(screen).to_not have_received(:from_readline)
      expect(screen.width).to eq(280)
      expect(screen.height).to eq(51)
    end

    it "allows to call size as class instance" do
      screen = double(:screen, size: [51, 280])
      allow(TTY::Screen).to receive(:new).and_return(screen)
      expect(TTY::Screen.size).to eq([51, 280])
      expect(TTY::Screen.width).to eq(280)
      expect(TTY::Screen.height).to eq(51)
      expect(TTY::Screen).to have_received(:new).exactly(3).times
    end
  end

  context 'from io console' do
    it "doesn't calculate size if jruby " do
      allow(screen).to receive(:jruby?).and_return(true)
      expect(screen.from_io_console).to eq(nil)
    end

{'fraction_non_alphanumeric': 0.15059726962457337, 'fraction_numerical': 0.02901023890784983, 'mean_word_length': 3.68063872255489, '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': '4296076', 'n_tokens_mistral': 855, 'n_tokens_neox': 778, 'n_words': 170}