# Returns the projects list, with their repositories
def projects_with_repository_enabled
- Project.repository_enabled(:all, :include => :repository)
+ Project.repository_enabled(:all, :include => :repository, :order => 'identifier')
end
# Registers a repository for the given project identifier
class SysController; def rescue_action(e) raise e end; end
class SysControllerTest < Test::Unit::TestCase
- fixtures :projects, :repositories
+ fixtures :projects, :enabled_modules, :repositories
def setup
@controller = SysController.new
Setting.sys_api_enabled = 1
end
- def test_projects
- result = invoke :projects
- assert_equal Project.count, result.size
- assert result.first.is_a?(Project)
+ def test_projects_with_repository_enabled
+ result = invoke :projects_with_repository_enabled
+ assert_equal EnabledModule.count(:all, :conditions => {:name => 'repository'}), result.size
+
+ project = result.first
+ assert project.is_a?(AWSProjectWithRepository)
+
+ assert project.respond_to?(:id)
+ assert_equal 1, project.id
+
+ assert project.respond_to?(:identifier)
+ assert_equal 'ecookbook', project.identifier
+
+ assert project.respond_to?(:name)
+ assert_equal 'eCookbook', project.name
+
+ assert project.respond_to?(:is_public)
+ assert project.is_public
+
+ assert project.respond_to?(:repository)
+ assert project.repository.is_a?(Repository)
end
def test_repository_created