<commit_before>require 'rails_helper'

<% output_attributes = model.columns.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
RSpec.describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do
  <%= model.factory_girl_let_definitions %>
  before(:each) do
    assign(:<%= table_name %>, [
<% [1,2].each_with_index do |id, model_index| -%>
  <%- if tc = model.title_column -%>
      <%= model.factory_girl_create(tc.name.to_sym => tc.sample_value(model_index + 1)) %>,
  <%- else -%>
      <%= model.factory_girl_create %>,
  <%- end -%>
<% end -%>
    ])
  end

  it "renders a list of <%= ns_table_name %>" do
    render
<% model.columns_for(:spec_index).each do |attribute| -%>
  <%- if attribute.ref_model || attribute.enumerized? -%>
    assert_select "tr>td", :text => <%= attribute.sample_string %>, :count => 2
  <%- else -%>
    assert_select "tr>td", :text => <%= attribute.sample_string(1) %>, :count => 1
    assert_select "tr>td", :text => <%= attribute.sample_string(2) %>, :count => 1
  <%- end -%>
<% end -%>
  end
end<commit_msg>Don't assert twice for boolean column in index view<commit_after>require 'rails_helper'

<% output_attributes = model.columns.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
RSpec.describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do
  <%= model.factory_girl_let_definitions %>
  before(:each) do
    assign(:<%= table_name %>, [
<% [1,2].each_with_index do |id, model_index| -%>
  <%- if tc = model.title_column -%>
      <%= model.factory_girl_create(tc.name.to_sym => tc.sample_value(model_index + 1)) %>,
  <%- else -%>
      <%= model.factory_girl_create %>,
  <%- end -%>
<% end -%>
    ])
  end

  it "renders a list of <%= ns_table_name %>" do
    render
<% model.columns_for(:spec_index).each do |attribute| -%>
  <%- if attribute.ref_model || attribute.enumerized? || attribute.type == :boolean -%>
    assert_select "tr>td", :text => <%= attribute.sample_string %>, :count => 2
  <%- else -%>
    assert_select "tr>td", :text => <%= attribute.sample_string(1) %>, :count => 1
    assert_select "tr>td", :text => <%= attribute.sample_string(2) %>, :count => 1
  <%- end -%>
<% end -%>
  end
end
{'fraction_non_alphanumeric': 0.2090017825311943, 'fraction_numerical': 0.0071301247771836, 'mean_word_length': 3.9232456140350878, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 65, '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': '3736810', 'n_tokens_mistral': 880, 'n_tokens_neox': 810, 'n_words': 149}