<commit_before>require_relative '../road_trip'

RSpec.describe RoadTrip do

  let(:segments) { [double('Segment', miles: 500), double('Segment', miles: 750)] }
  let(:road_trip) { RoadTrip.new(name: 'Trip to SF', participants: %w(<NAME>), segments: segments) }

  describe 'Attributes' do
    it 'has a name' do
      expect(road_trip.name).to eq 'Trip to SF'
    end

    it 'allows updates to name' do
      road_trip.name = 'Trip to NYC'
      expect(road_trip.name).to eq 'Trip to NYC'
    end

    it 'has participants' do
      expect(road_trip.participants).to match_array %w(<NAME>)
    end

    it 'has segments' do
      expect(road_trip.segments).to match_array [segment]
    end
  end

  describe '#add_segment' do
    it 'adds object to segement collection' do
      new_segment = double('New Segment')
      road_trip.add_segment(new_segment)
      expect(road_trip.segments).to include new_segment
    end
  end

  describe 'distance calculations' do
    describe '#total_miles' do
      it 'sums the miles of each segment' do
        expect(road_trip.total_miles).to eq 1250
      end
    end

    describe '#average_miles_per_segment' do
      it 'averages the miles of the trip over the segments' do
        expect(road_trip.average_miles_per_segment).to eq 625
      end
    end
  end

end<commit_msg>Update specs: wrap segement behaviors in example group<commit_after>require_relative '../road_trip'

RSpec.describe RoadTrip do

  let(:segments) { [double('Segment', miles: 500), double('Segment', miles: 750)] }
  let(:road_trip) { RoadTrip.new(name: 'Trip to SF', participants: %w(<NAME>), segments: segments) }

  describe 'attributes' do
    it 'has a name' do
      expect(road_trip.name).to eq 'Trip to SF'
    end

    it 'allows updates to name' do
      road_trip.name = 'Trip to NYC'
      expect(road_trip.name).to eq 'Trip to NYC'
    end

    it 'has participants' do
      expect(road_trip.participants).to match_array %w(<NAME>)
    end

    it 'has segments' do
      expect(road_trip.segments).to match_array [segment]
    end
  end

  describe 'working with segments' do
    describe '#add_segment' do
      it 'adds object to segement collection' do
        new_segment = double('New Segment')
        road_trip.add_segment(new_segment)
        expect(road_trip.segments).to include new_segment
      end
    end

    describe 'distance calculations' do
      describe '#total_miles' do
        it 'sums the miles of each segment' do
          expect(road_trip.total_miles).to eq 1250
        end
      end

      describe '#average_miles_per_segment' do
        it 'averages the miles of the trip over the segments' do
          expect(road_trip.average_miles_per_segment).to eq 625
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09304851556842868, 'fraction_numerical': 0.00941346850108617, 'mean_word_length': 2.930298719772404, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1855500', 'n_tokens_mistral': 940, 'n_tokens_neox': 858, 'n_words': 268}