<commit_before>require 'spec_helper'
require "active_support/core_ext/hash"
require "active_support/core_ext/object"

require 'datagrid/renderer'

describe Datagrid::Helper do
  subject do
    context = ActionView::LookupContext.new([
      File.expand_path("../../../app/views", __FILE__),
      File.expand_path("../../support/test_partials", __FILE__),
    ], {})
    template = ActionView::Base.new(context, {}, Object.new)
    allow(template).to receive(:protect_against_forgery?).and_return(false)
    template
  end

  before(:each) do
    allow(subject).to receive(:params).and_return({})
    allow(subject).to receive(:request) do
      Struct.new(:path, :query_parameters).new("/location", {})
    end
    allow(subject).to receive(:url_for) do |options|
      options.is_a?(String) ? options : ["/location", options.to_param.presence].compact.join('?')
    end

  end

  let(:group) { Group.create!(:name => "Pop") }
  let!(:entry) {  Entry.create!(<commit_msg>Fix tests for rails 4<commit_after>require 'spec_helper'
require "active_support/core_ext/hash"
require "active_support/core_ext/object"
require "action_controller"

require 'datagrid/renderer'

describe Datagrid::Helper do
  subject do
    context = ActionView::LookupContext.new([
      File.expand_path("../../../app/views", __FILE__),
      File.expand_path("../../support/test_partials", __FILE__),
    ], {})
    template = ActionView::Base.new(context, {}, ::ActionController::Base.new)
    allow(template).to receive(:protect_against_forgery?).and_return(false)
    template
  end

  before(:each) do
    allow(subject).to receive(:params).and_return({})
    allow(subject).to receive(:request) do
      Struct.new(:path, :query_parameters).new("/location", {})
    end
    allow(subject).to receive(:url_for) do |options|
      options.is_a?(String) ? options : ["/location", options.to_param.presence].compact.join('?')
    end

  end

  let(:group) { Group.create!(:name => "Pop") }
  let!(:entry) {  Entry.create!(
{'fraction_non_alphanumeric': 0.17017017017017017, 'fraction_numerical': 0.0005005005005005005, 'mean_word_length': 4.219321148825065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3075038', 'n_tokens_mistral': 644, 'n_tokens_neox': 633, 'n_words': 107}