<commit_before>require "rails_helper"

RSpec.describe NextBidder, type: :service do
  fixtures :all
  let(:game)             { games(:bidding_game) }
  #let(:round)            { rounds(:bidding_round) }
  let(:find_next_bidder) { NextBidder.new(round) }

  describe "#call" do
    context "when there are no passes" do
      10.times do |n|
        context "when it is the first round" do
          let(:round) { rounds(:bidding_round) }

          before do
            submit_bids(n)
            find_next_bidder.call
          end

          it "returns the correct bidder" do
            expect(find_next_bidder.next_bidder).to eq(players("bidder#{(n % game.players.count) + 1}"))
          end
        end
      end
    end

    context "when there are passes" do

    end

    context "when it is the fourth round" do

    end

    context "when it is the seventh round" do

    end

    def submit_bids(number_of_bids)
      number_of_bids.times do |n|
        round.bids.create!(player: players("bidder#{(n % game.players.count) + 1}"),
                           number_of_tricks: 6 + n,
                           suit: rand(0..(Bid.suits.length - 1)))
      end
    end<commit_msg>Add helper method for passing to next_bidder_spec<commit_after>require "rails_helper"

RSpec.describe NextBidder, type: :service do
  fixtures :all
  let(:game)             { games(:bidding_game) }
  #let(:round)            { rounds(:bidding_round) }
  let(:find_next_bidder) { NextBidder.new(round) }

  describe "#call" do
    context "when there are no passes" do
      10.times do |n|
        context "when it is the first round" do
          let(:round) { rounds(:bidding_round) }

          before do
            submit_bids(n)
            find_next_bidder.call
          end

          it "returns the correct bidder" do
            expect(find_next_bidder.next_bidder).to eq(players("bidder#{(n % game.players.count) + 1}"))
          end
        end
      end
    end

    context "when there are passes" do
      before { submit_passes(1) }

      it "returns the correct bidder" do

      end
    end

    context "when it is the fourth round" do

    end

    context "when it is the seventh round" do

    end
  end

  def submit_bids(number_of_bids)
    number_of_bids.times do |n|
      round.bids.create!(player: players("bidder#{(n % game.players.count) + 1}"),
                         number_of_tricks: 6 + n,
                         suit: rand(0..(Bid.suits.length - 1)))
    end
  end

  def submit_passes(number_of_passes)
    number_of_passes.times do |n|
      round.bids.create!(player: players("bidder#{(n % game.players.count) + 1}"),
                         number_of_tricks: 0,
                         suit: 0)
    end
{'fraction_non_alphanumeric': 0.10065645514223195, 'fraction_numerical': 0.006564551422319475, 'mean_word_length': 1.9880174291938997, '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': '7228417', 'n_tokens_mistral': 911, 'n_tokens_neox': 865, 'n_words': 227}