<commit_before>require File.dirname(__FILE__) + '/../../test_helper'
require 'tool/base_controller'

# Re-raise errors caught by the controller.
class Tool::BaseController; def rescue_action(e) raise e end; end

class Tool::BaseControllerTest < Test::Unit::TestCase
  fixtures :pages, :users, :user_participations

  def setup
    @controller = Tool::BaseController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end

  def test_set_summary
    login_as :quentin
    # there is something wrong with the following line...
    xhr :post, :summary, :page_id => 1, :summary => "new summary"
    
    assert_equal Page.find(1).summary, "new summary"
  end
end
<commit_msg>fix func test for changing page summary, add func test for changing page title<commit_after>require File.dirname(__FILE__) + '/../../test_helper'
require 'tool/base_controller'

# Re-raise errors caught by the controller.
class Tool::BaseController; def rescue_action(e) raise e end; end

class Tool::BaseControllerTest < Test::Unit::TestCase
  fixtures :pages, :users, :user_participations

  def setup
    @controller = Tool::BaseController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end

  def test_set_title
    login_as(:orange)
    post :title, :page_id => 1, :page => {:title => "new title"}
    assert_equal "new title", Page.find(1).title
  end

  def test_set_summary_ajax
    login_as :orange
    xhr :post, :summary, :page_id => 1, :page => {:summary => "new summary"}    
    assert_equal "new summary", Page.find(1).summary
  end

#  def test_set_summary_without_ajax
#    login_as :orange
#    post :summary, :page_id => 1, :page => {:summary => "new summary"}    
#    assert_equal "new summary", Page.find(1).summary
#  end
end

{'fraction_non_alphanumeric': 0.11767895878524946, 'fraction_numerical': 0.004338394793926247, 'mean_word_length': 4.096685082872928, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '1360161', 'n_tokens_mistral': 572, 'n_tokens_neox': 554, 'n_words': 161}