<commit_before>require 'spec_helper'

describe 'pages#index' do
  context 'with search parameter' do
    let! :page1 do
      create :page, :title => 'Chromodorididae Ardeadoris'
    end

    let! :page2 do
      create :page, :title => 'Chromodorididae Berlanguella'
    end

    let! :page3 do
      create :page, :title => 'Gastropoda'
    end

    context 'with multiple matches' do
      before do
        visit kuhsaft.pages_path(:locale => :en, :search => 'Chromodorididae')
      end

      it 'renders match count' do
        page.should have_content("2 Resultate")
      end

      it 'renders the search results list' do
        within("ul.search-results.success") do
          page.should have_content('Chromodorididae Ardeadoris')
          page.should have_content('Chromodorididae Berlanguella')
          page.should_not have_content('Gastropoda')
        end
      end

      it 'renders links to the pages' do
        within("ul.search-results.success") do
          page.should have_link('Chromodorididae Ardeadoris', href: page1.link)
          page.should have_link('Chromodorididae Berlanguella', href: page2.link)
        end
      end
    end

    context 'without matches' do
      before do
        visit kuhsaft.pages_path(:locale => :en, :search => 'foobar')
      end

      it 'renders match count' do
        page.should have_content("Keine Resultate")
      end
    end
  end
end<commit_msg>make page and route statements more verbose<commit_after>require 'spec_helper'

describe 'pages#index' do
  context 'with search parameter' do
    let! :page1 do
      create :page, :page_type => Kuhsaft::PageType::CONTENT, :published => true, :title => 'Chromodorididae Ardeadoris'
    end

    let! :page2 do
      create :page, :page_type => Kuhsaft::PageType::CONTENT, :published => true, :title => 'Chromodorididae Berlanguella'
    end

    let! :page3 do
      create :page, :page_type => Kuhsaft::PageType::CONTENT, :published => true, :title => 'Gastropoda'
    end

    context 'with multiple matches' do
      before do
        visit kuhsaft.pages_path(:locale => :en, :search => 'Chromodorididae')
      end

      it 'renders match count' do
        page.should have_content("2 results")
      end

      it 'renders the search results list' do
        within("ul.search-results.success") do
          page.should have_content('Chromodorididae Ardeadoris')
          page.should have_content('Chromodorididae Berlanguella')
          page.should_not have_content('Gastropoda')
        end
      end

      it 'renders links to the pages' do
        within("ul.search-results.success") do
          page.should have_link('Chromodorididae Ardeadoris', href: page1.link)
          page.should have_link('Chromodorididae Berlanguella', href: page2.link)
        end
      end
    end

    context 'without matches' do
      before do
        visit kuhsaft.pages_path(:locale => :en, :search => 'foobar')
      end

      it 'renders match count' do
        page.should have_content("No results")
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09689034369885434, 'fraction_numerical': 0.003927986906710311, 'mean_word_length': 2.677496991576414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '3717459', 'n_tokens_mistral': 967, 'n_tokens_neox': 934, 'n_words': 263}