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

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

class TeamControllerTest < Test::Unit::TestCase
  def setup
    @controller = TeamController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end

  # Replace this with your real tests.
  def test_truth
    assert true
  end
end<commit_msg>Some simple team controller tests.<commit_after>require File.dirname(__FILE__) + '/../test_helper'
require 'team_controller'

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

class TeamControllerTest < Test::Unit::TestCase
  
  fixtures :sports,
           :organisations,
           :users,
           :notices,
           :comments,
           :pages,
           :teams,
           :seasons,
           :competitions,
           :stages,
           :groups,
           :games
           
  def setup
    # Fix Rails induced problem of Integraton tests futzing with stuff.
    if ActionController::Base.respond_to? 'clear_last_instantiation!'
      ActionController::Base.clear_last_instantiation!
    end
    
    @controller = TeamController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
    
    @request.host = 'test.teamsquad.com'
  end

  #
  # ROUTING TESTS
  #
  
  def test_team_list_routing
    assert_routing 'teams',
      { :controller => 'team', :action => 'index' }
  end
  
  def test_new_team_routing
    assert_routing 'teams/new',
      { :controller => 'team', :action => 'new' }
  end
  
  def test_view_team_routing
    assert_routing 'teams/team-one',
      { :controller => 'team', :action => 'view', :team => 'team-one' }
  end
  
  def test_edit_team_routing
    assert_routing 'teams/team-one/edit',
      { :controller => 'team', :action => 'edit', :team => 'team-one' }
  end
  
  def test_view_team__fixtures_routing
    assert_routing 'teams/team-one/fixtures',
      { :controller => 'team', :action => 'fixtures', :team => 'team-one' }
  end
  
  def test_view_team_results_routing
    assert_routing 'teams/team-one/results',
      { :controller => 'team', :action => 'results', :team => 'team-one' }
  end
  
  #
  # ACCCESS CONTROL TESTS
  #
  
  def test_that_edit_action_is_protected_from_the_public
    get :edit, { :team => 'team-one' }
    assert_redirected_to login_url
  end
  
  def test_that_new_action_is_protected_from_the_public
    get :new
    assert_redirected_to login_url
  end
  
end
{'fraction_non_alphanumeric': 0.10500564546480994, 'fraction_numerical': 0.0, 'mean_word_length': 2.990990990990991, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '354581', 'n_tokens_mistral': 841, 'n_tokens_neox': 843, 'n_words': 191}