<commit_before>require 'pathname'
require Pathname(__FILE__).dirname.expand_path.join('..', 'spec_helper')

describe Yardstick do
  describe '.measure' do
    describe 'with no arguments' do
      before :all do
        @measurements = Yardstick.measure
      end

      it_should_behave_like 'measured itself'
    end

    describe 'with a String path' do
      before :all do
        @measurements = Yardstick.measure(Yardstick::ROOT.join('lib', 'yardstick.rb').to_s)
      end

      it_should_behave_like 'measured itself'
    end

    describe 'with a Pathname' do
      before :all do
        @measurements = Yardstick.measure(Yardstick::ROOT.join('lib', 'yardstick.rb'))
      end

      it_should_behave_like 'measured itself'
    end

    describe 'with an Array of String objects' do
      before :all do
        @measurements = Yardstick.measure([ Yardstick::ROOT.join('lib', 'yardstick.rb').to_s ])
      end

      it_should_behave_like 'measured itself'
    end

    describe 'with an Array of Pathname objects' do
      before :all do
        @measurements = Yardstick.measure([ Yardstick::ROOT.join('lib', 'yardstick.rb') ])
      end

      it_should_behave_like 'measured itself'
    end
  end

  describe '.measure_string' do
    describe 'with a String' do
      before do
        @measurements = Yardstick.measure_string('def test; end')
      end

      it 'should return a MeasurementSet' do
        @measurements.should be_kind_of(Yardstick::MeasurementSet)
      end

      it 'should be non-empty' do
        @measurements.should_not be_empty
      end
    end

    describe 'with no arguments' do
      it 'should raise an exception' do
        lambda {
          Yardstick.measure_string
        }.should raise_error(ArgumentError, 'wrong number of arguments (0 for 1)')
      end
    end
  end
end<commit_msg>Ensure specs pass with JRuby in addition to MRI 1.8.6, 1.8.7 and 1.9.1<commit_after>require 'pathname'
require Pathname(__FILE__).dirname.expand_path.join('..', 'spec_helper')

describe Yardstick do
  describe '.measure' do
    describe 'with no arguments' do
      before :all do
        @measurements = Yardstick.measure
      end

      it_should_behave_like 'measured itself'
    end

    describe 'with a String path' do
      before :all do
        @measurements = Yardstick.measure(Yardstick::ROOT.join('lib', 'yardstick.rb').to_s)
      end

      it_should_behave_like 'measured itself'
    end

    describe 'with a Pathname' do
      before :all do
        @measurements = Yardstick.measure(Yardstick::ROOT.join('lib', 'yardstick.rb'))
      end

      it_should_behave_like 'measured itself'
    end

    describe 'with an Array of String objects' do
      before :all do
        @measurements = Yardstick.measure([ Yardstick::ROOT.join('lib', 'yardstick.rb').to_s ])
      end

      it_should_behave_like 'measured itself'
    end

    describe 'with an Array of Pathname objects' do
      before :all do
        @measurements = Yardstick.measure([ Yardstick::ROOT.join('lib', 'yardstick.rb') ])
      end

      it_should_behave_like 'measured itself'
    end
  end

  describe '.measure_string' do
    describe 'with a String' do
      before do
        @measurements = Yardstick.measure_string('def test; end')
      end

      it 'should return a MeasurementSet' do
        @measurements.should be_kind_of(Yardstick::MeasurementSet)
      end

      it 'should be non-empty' do
        @measurements.should_not be_empty
      end
    end

    describe 'with no arguments' do
      it 'should raise an exception' do
        lambda {
          Yardstick.measure_string
        }.should raise_error(ArgumentError, RUBY_PLATFORM =~ /java/ ? 'wrong # of arguments(0 for 1)' : 'wrong number of arguments (0 for 1)')
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0896388083311363, 'fraction_numerical': 0.003954653308726601, 'mean_word_length': 2.6692456479690523, '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': '98168', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1121, 'n_words': 336}