<commit_before>require 'spec_helper'
require 'ruby_event_store/spec/event_repository_lint'

module RubyEventStore
  RSpec.describe InMemoryRepository do
    # There is no way to use in-memory adapter in a
    # lock-free, unlimited concurrency way
    let(:test_race_conditions_any)   { false }
    let(:test_race_conditions_auto)  { true }
    let(:test_expected_version_auto) { true }
    let(:test_link_events_to_stream) { true }

    it_behaves_like :event_repository, InMemoryRepository

    it 'does not allow same event twice in a stream - checks stream events before checking all events' do
      repository = InMemoryRepository.new
      repository.append_to_stream(
        TestDomainEvent.new(event_id: eid = "fbce0b3d-40e3-4d1d-90a1-901f1ded5a4a"),
        'other',
        -1<commit_msg>Make in-memory :any work without explict locks<commit_after>require 'spec_helper'
require 'ruby_event_store/spec/event_repository_lint'

module RubyEventStore
  RSpec.describe InMemoryRepository do
    # There is no way to use in-memory adapter in a
    # lock-free, unlimited concurrency way
    let(:test_race_conditions_any)   { true }
    let(:test_race_conditions_auto)  { true }
    let(:test_expected_version_auto) { true }
    let(:test_link_events_to_stream) { true }

    it_behaves_like :event_repository, InMemoryRepository

    it 'does not allow same event twice in a stream - checks stream events before checking all events' do
      repository = InMemoryRepository.new
      repository.append_to_stream(
        TestDomainEvent.new(event_id: eid = "fbce0b3d-40e3-4d1d-90a1-901f1ded5a4a"),
        'other',
        -1
{'fraction_non_alphanumeric': 0.07475490196078431, 'fraction_numerical': 0.020833333333333332, 'mean_word_length': 3.9186746987951806, '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': '2396771', 'n_tokens_mistral': 533, 'n_tokens_neox': 508, 'n_words': 125}