Makes users optional in GET /groups/:id (#8981).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9765 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-06-03 13:32:14 +00:00
parent 1c5b214056
commit 327d5d2132
2 changed files with 10 additions and 1 deletions

View File

@ -8,7 +8,7 @@ api.group do
@group.users.each do |user|
api.user :id => user.id, :name => user.name
end
end
end if include_in_api_response?('users')
api.array :memberships do
@group.memberships.each do |membership|

View File

@ -76,6 +76,15 @@ class ApiTest::GroupsTest < ActionController::IntegrationTest
assert_select 'group' do
assert_select 'name', :text => 'A Team'
assert_select 'id', :text => '10'
end
end
should "include users if requested" do
get '/groups/10.xml?include=users', {}, credentials('admin')
assert_response :success
assert_equal 'application/xml', response.content_type
assert_select 'group' do
assert_select 'users' do
assert_select 'user', Group.find(10).users.count
assert_select 'user[id=8]'