<commit_before>require 'spec_helper'

describe "show.html.erb" do

  subject { page }
  let(:component) { FactoryGirl.create(:component_part_of_item_with_content_has_apo) }
  before { visit component_path(component) }
  after do
    component.admin_policy.delete
    component.item.delete
    component.reload # work around https://github.com/projecthydra/active_fedora/issues/36
    component.delete
  end
  it { should have_content(component.pid) }
  it { should have_content(component.title.first) } 
  it { should have_content(component.identifier.first) }
  it { should have_link("DC") }
  it { should have_link("RELS-EXT") }
  it { should have_link("descMetadata") }
  it { should have_link("content") }
  
end
<commit_msg>refactored to improve coverage and reduce tests by using expect added test for link to parent object<commit_after>require 'spec_helper'

describe "show.html.erb" do
  subject { page }
  let(:component) { FactoryGirl.create(:component_part_of_item_with_content_has_apo) }
  before { visit component_path(component) }
  after do
    component.admin_policy.delete
    component.item.delete
    component.reload # work around https://github.com/projecthydra/active_fedora/issues/36
    component.delete
  end
  it "should display the PID, title and identifier" do
    expect(subject).to have_content(component.pid)
    expect(subject).to have_content(component.title.first)
    expect(subject).to have_content(component.identifier.first)
  end
  it "should have links to datastreams" do
    component.datastreams.each_key do |dsid|
      expect(subject).to have_link(dsid)
    end
  end  
  it "should have a link to its parent object" do
    expect(subject).to have_link(item_path(component.item))
  end
end

{'fraction_non_alphanumeric': 0.09457900807381776, 'fraction_numerical': 0.002306805074971165, 'mean_word_length': 4.371517027863777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4034422', 'n_tokens_mistral': 546, 'n_tokens_neox': 531, 'n_words': 126}