Fixes functional tests.
git-svn-id: http://redmine.rubyforge.org/svn/branches/nbc@1804 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
8e48c9ff9d
commit
c77d9712ca
2 files changed
+23
-6
No files matched your search
@@ -24,7 +24,7 @@ class SysController < ActionController::Base
|
|||||||
|
|
||||||
# Returns the projects list, with their repositories
|
# Returns the projects list, with their repositories
|
||||||
def projects_with_repository_enabled
|
def projects_with_repository_enabled
|
||||||
Project.repository_enabled(:all, :include => :repository)
|
Project.repository_enabled(:all, :include => :repository, :order => 'identifier')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Registers a repository for the given project identifier
|
# Registers a repository for the given project identifier
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ require 'sys_controller'
|
|||||||
class SysController; def rescue_action(e) raise e end; end
|
class SysController; def rescue_action(e) raise e end; end
|
||||||
|
|
||||||
class SysControllerTest < Test::Unit::TestCase
|
class SysControllerTest < Test::Unit::TestCase
|
||||||
fixtures :projects, :repositories
|
fixtures :projects, :enabled_modules, :repositories
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@controller = SysController.new
|
@controller = SysController.new
|
||||||
@@ -15,10 +15,27 @@ class SysControllerTest < Test::Unit::TestCase
|
|||||||
Setting.sys_api_enabled = 1
|
Setting.sys_api_enabled = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_projects
|
def test_projects_with_repository_enabled
|
||||||
result = invoke :projects
|
result = invoke :projects_with_repository_enabled
|
||||||
assert_equal Project.count, result.size
|
assert_equal EnabledModule.count(:all, :conditions => {:name => 'repository'}), result.size
|
||||||
assert result.first.is_a?(Project)
|
|
||||||
|
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
|
end
|
||||||
|
|
||||||
def test_repository_created
|
def test_repository_created
|
||||||
|
|||||||
Reference in new issue
Block a user