<commit_before>require 'spec_helper'

describe Link do

  let(:user) { create :user }
  let(:repository) { create :repository }
  let(:external_repository) { ExternalRepository.repository }

  context 'when importing an ontology' do
    context 'which belongs to a distributed ontology' do

      let(:dist_ontology) { create :distributed_ontology }
      let(:target_ontology) { dist_ontology.children.find_by_name('Features') }

      context 'and imports another ontology' do
        let(:source_ontology) { external_repository.ontologies.find_by_name('path:features.owl') }

        context 'which is not part of the distributed ontology' do
          let(:link) { dist_ontology.links.first }

          before do
            parse_this(user, dist_ontology, fixture_file('reference.xml'), fixture_file('reference.pp.xml'))
          end

          it 'should have the link-source set correctly' do
            expect(link.source).to eq(source_ontology)
          end
          it 'should have the link-target set correctly' do
            expect(link.target).to eq(target_ontology)<commit_msg>fix link-spec for hets-api.<commit_after>require 'spec_helper'

describe Link do

  let(:user) { create :user }
  let(:repository) { create :repository }
  let(:external_repository) { ExternalRepository.repository }

  context 'when importing an ontology' do
    context 'which belongs to a distributed ontology' do

      let(:dist_ontology) { create :distributed_ontology }
      let(:target_ontology) { dist_ontology.children.find_by_name('Features') }

      context 'and imports another ontology' do
        let(:source_ontology) { external_repository.ontologies.find_by_name('path:features.owl') }

        context 'which is not part of the distributed ontology' do
          let(:link) { dist_ontology.links.first }

          before do
            parse_this(user, dist_ontology, fixture_file('reference'))
          end

          it 'should have the link-source set correctly' do
            expect(link.source).to eq(source_ontology)
          end
          it 'should have the link-target set correctly' do
            expect(link.target).to eq(target_ontology)
{'fraction_non_alphanumeric': 0.09170506912442396, 'fraction_numerical': 0.0, 'mean_word_length': 3.1510516252390057, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4193702', 'n_tokens_mistral': 611, 'n_tokens_neox': 577, 'n_words': 161}