<commit_before>require 'test_helper'
require 'libxml'

class ProjectsControllerTest < ActionController::TestCase

	include AuthenticatedTestHelper
	include RestTestCases
  include RdfTestCases

	fixtures :all

	def setup
		login_as(Factory(:admin))
  end

  def rest_api_test_object
    @object=projects(:sysmo_project)
  end

  def test_title
		get :index
		assert_select "title",:text=>/The Sysmo SEEK #{I18n.t('project').pluralize}.*/, :count=>1
	end

	def test_should_get_index
		get :index
		assert_response :success
		assert_not_nil assigns(:projects)
	end

	def test_should_get_new
		get :new
		assert_response :success
  end

  def test_avatar_show_in_list
    p=Factory :project
    get :index
    assert_select "div.list_items_container" do
      assert_select "div.list_item" do
        assert_select "div.list_item_avatar" do
          assert_select "a[href=?]",project_path(p)
        end
      end
    end
  end

	def test_should_create_project
		assert_difference('Project.count') do
			post :create, :project => {:title=>"test"}
		end

		assert_redirected_to project_path(assigns(:project))
	end

  def test_should_create_project
    parent_id = Factory(:project,:title=>"Test Parent").id
		assert_difference('Project.count') do
			post :create, :project => {:title=>"test",:parent_id=>parent_id}
		end

		assert_redirected_to project_path(assigns(:project))
	end<commit_msg>removed duplication of project functional test<commit_after>require 'test_helper'
require 'libxml'

class ProjectsControllerTest < ActionController::TestCase

	include AuthenticatedTestHelper
	include RestTestCases
  include RdfTestCases

	fixtures :all

	def setup
		login_as(Factory(:admin))
  end

  def rest_api_test_object
    @object=projects(:sysmo_project)
  end

  def test_title
		get :index
		assert_select "title",:text=>/The Sysmo SEEK #{I18n.t('project').pluralize}.*/, :count=>1
	end

	def test_should_get_index
		get :index
		assert_response :success
		assert_not_nil assigns(:projects)
	end

	def test_should_get_new
		get :new
		assert_response :success
  end

  def test_avatar_show_in_list
    p=Factory :project
    get :index
    assert_select "div.list_items_container" do
      assert_select "div.list_item" do
        assert_select "div.list_item_avatar" do
          assert_select "a[href=?]",project_path(p)
        end
      end
    end
  end

  def test_should_create_project
    parent = Factory(:project,:title=>"Test Parent")
		assert_difference('Project.count') do
			post :create, :project => {:title=>"test",:parent_id=>parent.id}
		end

		assert_redirected_to project_path(assigns(:project))
    assert_includes assigns(:project).ancestors,parent
	end
{'fraction_non_alphanumeric': 0.09223300970873786, 'fraction_numerical': 0.0022404779686333084, 'mean_word_length': 4.512345679012346, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3215326', 'n_tokens_mistral': 943, 'n_tokens_neox': 872, 'n_words': 190}