def fetch_changesets
projects = []
+ scope = Project.active.has_module(:repository)
if params[:id]
- projects << Project.active.has_module(:repository).find(params[:id])
+ project = nil
+ if params[:id].to_s =~ /^\d*$/
+ project = scope.find(params[:id])
+ else
+ project = scope.find_by_identifier(params[:id])
+ end
+ raise ActiveRecord::RecordNotFound unless project
+ projects << project
else
- projects = Project.active.has_module(:repository).all
+ projects = scope.all
end
projects.each do |project|
project.repositories.each do |repository|
assert_response :success
end
- def test_fetch_changesets_one_project
+ def test_fetch_changesets_one_project_by_identifier
Repository::Subversion.any_instance.expects(:fetch_changesets).once.returns(true)
get :fetch_changesets, :id => 'ecookbook'
assert_response :success
end
+ def test_fetch_changesets_one_project_by_id
+ Repository::Subversion.any_instance.expects(:fetch_changesets).once.returns(true)
+ get :fetch_changesets, :id => '1'
+ assert_response :success
+ end
+
def test_fetch_changesets_unknown_project
get :fetch_changesets, :id => 'unknown'
assert_response 404