<commit_before>#!/usr/bin/env ruby
# encoding: UTF-8

require 'test_helper'

#Controller who's views are all in the .html.erb format
class ErbArticlesController < ActionController::Base
  
  def custom_one
    @article = Article.find(params[:id])
    respond_to do |format|
      format.html #default
      format.pdf { render :pdf => {
        :template => 'erb_articles/alternate_custom_one',
        :filename => "custom_one.pdf"
      }}
    end
  end
end

class ErbViewsTest < ActionController::TestCase
  
  def setup
    prepop_db
    @controller = ErbArticlesController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end
  
  def test_which_prince_should_return_path_to_prince
    # why does this not work
    assert `which prince`.match(/prince$/), "which prince returned - #{`which prince`.inspect}"
  end
  
  def test_articles_custom_one
    get :custom_one, {:id => 1}
    assert_select 'h1', 'Article1'
    get :custom_one, {:id => 1, :format => 'pdf'}
    assert @response.body.match(/^%PDF/)
    assert(@response.body.length > 30000)
  end
end<commit_msg>add a test that passes no render options<commit_after>#!/usr/bin/env ruby
# encoding: UTF-8

require 'test_helper'

#Controller who's views are all in the .html.erb format
class ErbArticlesController < ActionController::Base
  
  def show
    @article = Article.find(params[:id])
    
    respond_to do |format|
      format.html
      format.pdf { render :pdf => {} }
    end
  end
  
  def custom_one
    @article = Article.find(params[:id])
    respond_to do |format|
      format.html #default
      format.pdf { render :pdf => {
        :template => 'erb_articles/alternate_custom_one',
        :filename => "custom_one.pdf"
      }}
    end
  end
end

class ErbViewsTest < ActionController::TestCase
  
  def setup
    prepop_db
    @controller = ErbArticlesController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end
  
  
  # show
  def test_should_get_show_and_return_html
    get :show, :id => 1
    assert_response :success
    assert !@response.body.match(/^%PDF/)
  end
  
  def test_should_generate_pdf_with_no_argugments
    get :show, :id => 1, :format => 'pdf'
    assert_response :success
    assert @response.body.match(/^%PDF/)
  end
  
  
  # custom_one
  def test_articles_custom_one
    get :custom_one, :id => 1
    assert_select 'h1', 'Article1'
    get :custom_one, {:id => 1, :format => 'pdf'}
    assert @response.body.match(/^%PDF/)
    assert(@response.body.length > 30000)
  end
end
{'fraction_non_alphanumeric': 0.11208875286916603, 'fraction_numerical': 0.008416220351951033, 'mean_word_length': 3.1773162939297124, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, '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': '5487922', 'n_tokens_mistral': 885, 'n_tokens_neox': 852, 'n_words': 203}