<commit_before>require 'spec_helper'

describe RunsHelper do
  context "There are scraped domains" do
    let(:foo_domain) { mock_model(Domain, name: "foo.com")}
    let(:bar_domain) { mock_model(Domain, name: "bar.com")}
    let(:www_foo_domain) { mock_model(Domain, name: "www.foo.com")}
    let(:www_bar_domain) { mock_model(Domain, name: "www.bar.com")}
    let(:fiddle_domain) { mock_model(Domain, name: "fiddle.com")}

    describe "#scraped_domains_list" do
      describe "#scraped_domains_list with links" do
        it do
          expect(helper.scraped_domains_list([foo_domain], true)).to eq '<a href="http://foo.com" target="_blank">foo.com</a>'
          expect(helper.scraped_domains_list([foo_domain], true)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain], true)).to eq '<a href="http://foo.com" target="_blank">foo.com</a> and <a href="http://bar.com" target="_blank">bar.com</a>'
          expect(helper.scraped_domains_list([foo_domain, bar_domain], true)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain], true)).to eq '<a href="http://foo.com" target="_blank">foo.com</a>, <a href="http://bar.com" target="_blank">bar.com</a>, and <a href="http://www.foo.com" target="_blank">www.foo.com</a>'
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain], true)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain, www_bar_domain], true)).to eq '<a href="http://foo.com" target="_blank">foo.com</a>, <a href="http://bar.com" target="_blank">bar.com</a>, <a href="http://www.foo.com" target="_blank">www.foo.com</a>, and 1 other domain'
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain, www_bar_domain], true)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain, www_bar_domain, fiddle_domain], true)).to eq '<a href="http://foo.com" target="_blank">foo.com</a>, <a href="http://bar.com" target="_blank">bar.com</a>, <a href="http://www.foo.com" target="_blank">www.foo.com</a>, and 2 other domains'
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain, www_bar_domain, fiddle_domain], true)).to be_html_safe
        end
      end

      describe "#scraped_domains_list without links" do
        it do
          expect(helper.scraped_domains_list([foo_domain], false)).to eq 'foo.com'
          expect(helper.scraped_domains_list([foo_domain], false)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain], false)).to eq 'foo.com and bar.com'
          expect(helper.scraped_domains_list([foo_domain, bar_domain], false)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain], false)).to eq 'foo.com, bar.com, and www.foo.com'
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain], false)).to be_html_safe
        end<commit_msg>Remove repetition in test description block titles (refactor only)<commit_after>require 'spec_helper'

describe RunsHelper do
  context "There are scraped domains" do
    let(:foo_domain) { mock_model(Domain, name: "foo.com")}
    let(:bar_domain) { mock_model(Domain, name: "bar.com")}
    let(:www_foo_domain) { mock_model(Domain, name: "www.foo.com")}
    let(:www_bar_domain) { mock_model(Domain, name: "www.bar.com")}
    let(:fiddle_domain) { mock_model(Domain, name: "fiddle.com")}

    describe "#scraped_domains_list" do
      describe "#with links" do
        it do
          expect(helper.scraped_domains_list([foo_domain], true)).to eq '<a href="http://foo.com" target="_blank">foo.com</a>'
          expect(helper.scraped_domains_list([foo_domain], true)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain], true)).to eq '<a href="http://foo.com" target="_blank">foo.com</a> and <a href="http://bar.com" target="_blank">bar.com</a>'
          expect(helper.scraped_domains_list([foo_domain, bar_domain], true)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain], true)).to eq '<a href="http://foo.com" target="_blank">foo.com</a>, <a href="http://bar.com" target="_blank">bar.com</a>, and <a href="http://www.foo.com" target="_blank">www.foo.com</a>'
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain], true)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain, www_bar_domain], true)).to eq '<a href="http://foo.com" target="_blank">foo.com</a>, <a href="http://bar.com" target="_blank">bar.com</a>, <a href="http://www.foo.com" target="_blank">www.foo.com</a>, and 1 other domain'
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain, www_bar_domain], true)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain, www_bar_domain, fiddle_domain], true)).to eq '<a href="http://foo.com" target="_blank">foo.com</a>, <a href="http://bar.com" target="_blank">bar.com</a>, <a href="http://www.foo.com" target="_blank">www.foo.com</a>, and 2 other domains'
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain, www_bar_domain, fiddle_domain], true)).to be_html_safe
        end
      end

      describe "#without links" do
        it do
          expect(helper.scraped_domains_list([foo_domain], false)).to eq 'foo.com'
          expect(helper.scraped_domains_list([foo_domain], false)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain], false)).to eq 'foo.com and bar.com'
          expect(helper.scraped_domains_list([foo_domain, bar_domain], false)).to be_html_safe
        end

        it do
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain], false)).to eq 'foo.com, bar.com, and www.foo.com'
          expect(helper.scraped_domains_list([foo_domain, bar_domain, www_foo_domain], false)).to be_html_safe
        end
{'fraction_non_alphanumeric': 0.14941634241245136, 'fraction_numerical': 0.000622568093385214, 'mean_word_length': 3.8866920152091256, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 46, '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': '342387', 'n_tokens_mistral': 2191, 'n_tokens_neox': 2122, 'n_words': 399}