<commit_before>require 'rails_helper'

RSpec.describe ChangeDealer do
  describe "#call" do
    subject(:service) { ChangeDealer.new(game) }

    let(:game) { Game.create! }

    it "adds a DealerChanged event to the game" do
      service.call
      game.reload
      expect(game.events.last).to be_instance_of DealerChanged
    end
  end
end
<commit_msg>Add test case for cycling the dealer<commit_after>require 'rails_helper'

RSpec.describe ChangeDealer do
  describe "#call" do
    subject(:service) { ChangeDealer.new(game) }

    let(:game) { Game.create! }

    context "with no previous dealer" do
      it "adds a DealerChanged event to the game" do
        service.call
        game.reload
        expect(game.events.last).to be_instance_of DealerChanged
      end
    end

    context "with a previous dealer" do
      it "adds a DealerChanged event to the game" do
        2.times { service.call }
        game.reload
        expect(game.events.last).to be_instance_of DealerChanged
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.080078125, 'fraction_numerical': 0.0009765625, 'mean_word_length': 2.7683823529411766, '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': '5507736', 'n_tokens_mistral': 322, 'n_tokens_neox': 311, 'n_words': 94}