<commit_before>describe FirmwareBinary do
  subject { FactoryBot.create(:firmware_binary) }

  describe '#allow_duplicate_endpoint_url?' do
    let(:binary1) { FactoryBot.create(:firmware_binary) }
    let(:binary2) { FactoryBot.create(:firmware_binary) }

    it 'has the flag set' do
      expect(subject.allow_duplicate_endpoint_url?).to eq(true)
    end

    it 'two different binaries are allowed to have same url' do
      expect do
        binary1.endpoints << FactoryBot.create(:endpoint, :url => 'same-url', :resource => binary1)
        binary2.endpoints << FactoryBot.create(:endpoint, :url => 'same-url', :resource => binary2)
      end.not_to raise_error
    end
  end

  describe '#urls' do
    it 'lists from all endpoints' do
      subject.endpoints << FactoryBot.create(:endpoint, :url => 'url1')
      subject.endpoints << FactoryBot.create(:endpoint, :url => 'url2')
      expect(subject.urls).to eq(%w[url1 url2])
    end
  end

  describe '#has_many endpoints' do
    before { subject.endpoints = [endpoint1, endpoint2] }<commit_msg>fix sporadic firmware binary spec<commit_after>describe FirmwareBinary do
  subject { FactoryBot.create(:firmware_binary) }

  describe '#allow_duplicate_endpoint_url?' do
    let(:binary1) { FactoryBot.create(:firmware_binary) }
    let(:binary2) { FactoryBot.create(:firmware_binary) }

    it 'has the flag set' do
      expect(subject.allow_duplicate_endpoint_url?).to eq(true)
    end

    it 'two different binaries are allowed to have same url' do
      expect do
        binary1.endpoints << FactoryBot.create(:endpoint, :url => 'same-url', :resource => binary1)
        binary2.endpoints << FactoryBot.create(:endpoint, :url => 'same-url', :resource => binary2)
      end.not_to raise_error
    end
  end

  describe '#urls' do
    it 'lists from all endpoints' do
      subject.endpoints << FactoryBot.create(:endpoint, :url => 'url1')
      subject.endpoints << FactoryBot.create(:endpoint, :url => 'url2')
      expect(subject.urls).to match_array(%w[url1 url2])
    end
  end

  describe '#has_many endpoints' do
    before { subject.endpoints = [endpoint1, endpoint2] }
{'fraction_non_alphanumeric': 0.12072999532054282, 'fraction_numerical': 0.011230697239120261, 'mean_word_length': 3.7616926503340755, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, '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': '2538145', 'n_tokens_mistral': 671, 'n_tokens_neox': 642, 'n_words': 164}