<commit_before>require 'spec_helper'

shared_examples "a catalog index view" do
  it "should display the PID, model, title and identifier(s)" do
    expect(subject).to have_content(object.pid)
    expect(subject).to have_content(object.class.to_s)
    expect(subject).to have_content(object.title_display)
    expect(subject).to have_content(object.identifier.first)
    expect(subject).to have_css(".thumbnail")
  end
end

describe "catalog/index.html.erb" do
  subject { page }
  let(:object) { FactoryGirl.create(:test_content_thumbnail) }
  after { object.delete }
  context "search by title" do
    before do
      visit catalog_index_path
      fill_in "q", :with => object.title.first
      click_button "search"
    end
    it_behaves_like "a catalog index view"
  end
  context "search by identifier" do
    pending
  end
end
<commit_msg>added test for thumnail link<commit_after>require 'spec_helper'

shared_examples "a catalog index view" do
  it "should display the PID, model, title and identifier(s)" do
    expect(subject).to have_content(object.pid)
    expect(subject).to have_content(object.class.to_s)
    expect(subject).to have_content(object.identifier.first)
    # title link
    expect(subject).to have_link(object.title_display, :href => catalog_path(object))
    # thumbnail
    expect(subject).to have_xpath('//a[@href = "#{catalog_path(object)}"]/img[@src = "#{thumbnail_path(object)}"]')
  end
end

describe "catalog/index.html.erb" do
  subject { page }
  let(:object) { FactoryGirl.create(:test_content_thumbnail) }
  after { object.delete }
  context "search by title" do
    before do
      visit catalog_index_path
      fill_in "q", :with => object.title.first
      click_button "search"
    end
    it_behaves_like "a catalog index view"
  end
  context "search by identifier" do
    pending
  end
end

{'fraction_non_alphanumeric': 0.10652173913043478, 'fraction_numerical': 0.0, 'mean_word_length': 4.043835616438356, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '664958', 'n_tokens_mistral': 588, 'n_tokens_neox': 579, 'n_words': 149}