<commit_before>require_relative 'message_init'

context "Metadata Precedence" do
  source_metadata = EventStore::Messaging::Controls::Message::Metadata.example
  metadata = EventStore::Messaging::Message::Metadata.new

  context "Relevant attributes are equal" do
    test "Message metadata has precedence" do
      metadata.causation_event_uri = source_metadata.source_event_uri
      metadata.correlation_stream_name = source_metadata.correlation_stream_name
      metadata.reply_stream_name = source_metadata.reply_stream_name

      assert(metadata.precedence?(source_metadata))
    end
  end

  context "Any of the relevant attributes are not equal" do
    [:causation_event_uri, :correlation_stream_name, :reply_stream_name].each do |attribute|

      test attribute do
        metadata.causation_event_uri = source_metadata.source_event_uri
        metadata.correlation_stream_name = source_metadata.correlation_stream_name
        metadata.reply_stream_name = source_metadata.reply_stream_name

        metadata.send "#{attribute}=", SecureRandom.hex

        assert(!metadata.precedence?(source_metadata))
      end
    end
  end
end<commit_msg>Test Bench does not allow symbols for prose<commit_after>require_relative 'message_init'

context "Metadata Precedence" do
  source_metadata = EventStore::Messaging::Controls::Message::Metadata.example
  metadata = EventStore::Messaging::Message::Metadata.new

  context "Relevant attributes are equal" do
    test "Message metadata has precedence" do
      metadata.causation_event_uri = source_metadata.source_event_uri
      metadata.correlation_stream_name = source_metadata.correlation_stream_name
      metadata.reply_stream_name = source_metadata.reply_stream_name

      assert(metadata.precedence?(source_metadata))
    end
  end

  context "Any of the relevant attributes are not equal" do
    [:causation_event_uri, :correlation_stream_name, :reply_stream_name].each do |attribute|

      test attribute.to_s do
        metadata.causation_event_uri = source_metadata.source_event_uri
        metadata.correlation_stream_name = source_metadata.correlation_stream_name
        metadata.reply_stream_name = source_metadata.reply_stream_name

        metadata.send "#{attribute}=", SecureRandom.hex

        assert(!metadata.precedence?(source_metadata))
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0695689287238583, 'fraction_numerical': 0.0, 'mean_word_length': 4.7310513447432765, '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': '7546171', 'n_tokens_mistral': 662, 'n_tokens_neox': 627, 'n_words': 132}