<commit_before>describe "printing submission's rates in submission show view" do

let!(:submission) { FactoryGirl.create(:submission) }
let!(:user) { FactoryGirl.create(:user) }
  context "when the submission has required number of rates" do

    it "shows ratings in submission view" do
      Submission::REQUIRED_RATES_NUM.times do
        rate = FactoryGirl.create(:rate)
        submission.rates << rate
      end
      sample_rate = submission.rates.sample

      login_as(user, scope: :user)
      visit submission_path(submission.id)
      expect(page).to have_text(sample_rate.user.nickname)
      expect(page).to have_text(sample_rate.value)
    end
  end

  context "when the submission does not have required number of rates" do

    it "does not show ratings in submission view" do
      (Submission::REQUIRED_RATES_NUM - 1).times do
        rate = FactoryGirl.create(:rate)
        submission.rates << rate
      end
      sample_rate = submission.rates.sample

      login_as(user, scope: :user)
      visit submission_path(submission.id)
      expect(page).not_to have_text(sample_rate.user.nickname)
      expect(page).not_to have_text(sample_rate.value)
    end
  end
end<commit_msg>Fix submission_print_rate_spec<commit_after>describe "printing submission's rates in submission show view" do

let!(:submission) { FactoryGirl.create(:submission) }
let!(:user) { FactoryGirl.create(:user) }
  context "when the submission has required number of rates" do

    it "shows ratings in submission view" do
      Submission::REQUIRED_RATES_NUM.times do
        rate = FactoryGirl.create(:rate)
        submission.rates << rate
      end
      sample_rate = submission.rates.sample

      login_as(user, scope: :user)
      visit submission_path(submission.id)
      expect(page).to have_text("#{sample_rate.user.nickname} #{sample_rate.value}")
    end
  end

  context "when the submission does not have required number of rates" do

    it "does not show ratings in submission view" do
      (Submission::REQUIRED_RATES_NUM - 1).times do
        rate = FactoryGirl.create(:rate)
        submission.rates << rate
      end
      sample_rate = submission.rates.sample

      login_as(user, scope: :user)
      visit submission_path(submission.id)
      expect(page).not_to have_text("#{sample_rate.user.nickname} #{sample_rate.value}")
    end
  end
end
{'fraction_non_alphanumeric': 0.09310198899703766, 'fraction_numerical': 0.0008463817181548879, 'mean_word_length': 3.4269662921348316, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '1550596', 'n_tokens_mistral': 720, 'n_tokens_neox': 693, 'n_words': 184}