<commit_before>require 'spec_helper'

describe Alephant::Preview::FixtureLoader do
  let (:fixtures_base) { File.join(File.dirname(__FILE__), 'fixtures') }
  let (:base_path) { File.join(fixtures_base, 'components', 'bar') }
  subject { described_class.new(base_path) }

  describe ".new" do

    context 'using valid parameters' do
      let (:expected) { described_class }

      specify { expect(subject).to be_a expected }
    end
  end

  describe "#get" do
    let (:uri) { '/test/uri' }

    context 'with a single fixture' do
      let (:fixture_data) { File.open(File.join(fixtures_base, 'components', 'bar', 'fixtures', 'bar.json')).read }
      specify { expect(subject.get(uri).body).to eq fixture_data}
    end

    context 'with multiple fixtures' do
      let (:base_path) { File.join(fixtures_base, 'components', 'baz') }
      let (:fixture_data) do
        fixtures = Dir.glob(File.join(fixtures_base, 'components', 'baz', 'fixtures', '*'))
        fixtures.map { |fixture| File.open(fixture).read }
      end

      context 'using a valid amount of fixtures' do

        it "should return each fixture on subsequent calls" do
          (0..2).each do |index|
            expect(subject.get(uri).body).to eq fixture_data[index]
          end
        end
      end

      context 'using incorrect amount of fixtures' do
        it "should raise an exception" do
          (0..2).each { |index| subject.get(uri).body }
          expect{ subject.get(uri).body }.to raise_error(RuntimeError,
            "There isn't a fixture matching the request call, please add one")
        end
      end
    end
  end
end<commit_msg>Multiline incorrect amount of fixtures spec<commit_after>require 'spec_helper'

describe Alephant::Preview::FixtureLoader do
  let (:fixtures_base) { File.join(File.dirname(__FILE__), 'fixtures') }
  let (:base_path) { File.join(fixtures_base, 'components', 'bar') }
  subject { described_class.new(base_path) }

  describe ".new" do

    context 'using valid parameters' do
      let (:expected) { described_class }

      specify { expect(subject).to be_a expected }
    end
  end

  describe "#get" do
    let (:uri) { '/test/uri' }

    context 'with a single fixture' do
      let (:fixture_data) { File.open(File.join(fixtures_base, 'components', 'bar', 'fixtures', 'bar.json')).read }
      specify { expect(subject.get(uri).body).to eq fixture_data}
    end

    context 'with multiple fixtures' do
      let (:base_path) { File.join(fixtures_base, 'components', 'baz') }
      let (:fixture_data) do
        fixtures = Dir.glob(File.join(fixtures_base, 'components', 'baz', 'fixtures', '*'))
        fixtures.map { |fixture| File.open(fixture).read }
      end

      context 'using a valid amount of fixtures' do

        it "should return each fixture on subsequent calls" do
          (0..2).each do |index|
            expect(subject.get(uri).body).to eq fixture_data[index]
          end
        end
      end

      context "using incorrect amount of fixtures" do
        it "should raise an exception" do
          (0..2).each { |index| subject.get(uri).body }
          expect do
            subject.get(uri).body
          end.to raise_error(
            RuntimeError, "There isn't a fixture matching the request call, please add one"
          )
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.12155688622754492, 'fraction_numerical': 0.0023952095808383233, 'mean_word_length': 2.7246376811594204, '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': '6172262', 'n_tokens_mistral': 1040, 'n_tokens_neox': 995, 'n_words': 288}