<commit_before>require 'spec_helper'

describe Admin::IssuesController do
  let(:issue)   { Issue.make!  }
  let(:user)    { User.make! role: 'superadmin'  }
  before(:each) { sign_in user }

  def issue_params(issue)
    issue.as_json except: [:created_at, :id, :last_updated_by_id, :slug, :updated_at]
  end

  def votes_params(connections)
    params = {}

    connections.each do |connection|
      params[connection.vote_id] = {
        :direction   => connection.matches? ? 'for' : 'against',
        :weight      => connection.weight,
        :comment     => connection.comment,
        :title       => connection.title
      }
    end

    params
  end

  it "should get :index" do
    issues = [issue]

    get :index
    reponse.should be_ok

    assigns(:issues_by_status).should == {'in_progress' => [issue]}
    response.should have_rendered(:index)
  end

  it 'should get :new' do
    get :new

    response.should have_rendered(:new)

    session[:issue_step].should == 'categories'<commit_msg>Apparently this is my favorite typo.<commit_after>require 'spec_helper'

describe Admin::IssuesController do
  let(:issue)   { Issue.make!  }
  let(:user)    { User.make! role: 'superadmin'  }
  before(:each) { sign_in user }

  def issue_params(issue)
    issue.as_json except: [:created_at, :id, :last_updated_by_id, :slug, :updated_at]
  end

  def votes_params(connections)
    params = {}

    connections.each do |connection|
      params[connection.vote_id] = {
        :direction   => connection.matches? ? 'for' : 'against',
        :weight      => connection.weight,
        :comment     => connection.comment,
        :title       => connection.title
      }
    end

    params
  end

  it "should get :index" do
    issues = [issue]

    get :index
    response.should be_ok

    assigns(:issues_by_status).should == {'in_progress' => [issue]}
    response.should have_rendered(:index)
  end

  it 'should get :new' do
    get :new

    response.should have_rendered(:new)

    session[:issue_step].should == 'categories'
{'fraction_non_alphanumeric': 0.12377690802348336, 'fraction_numerical': 0.0, 'mean_word_length': 2.925143953934741, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1881157', 'n_tokens_mistral': 669, 'n_tokens_neox': 639, 'n_words': 148}