fix groups_controller_spec for rails 3

Change-Id: Iafbe1ef3a274d3c2c863ff4ca7fbf16cb9d84fcb
Reviewed-on: https://gerrit.instructure.com/29900
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
This commit is contained in:
Landon Wilkins 2014-02-10 13:52:06 -07:00 committed by Landon Wilkins
parent 0c0673d252
commit ce49dc7ed9
2 changed files with 13 additions and 19 deletions

View File

@ -109,9 +109,7 @@ class GroupsController < ApplicationController
def context_group_members
@group = @context
if authorized_action(@group, @current_user, :read_roster)
respond_to do |format|
format.json { render :json => @group.members_json_cached }
end
render :json => @group.members_json_cached
end
end
@ -136,20 +134,16 @@ class GroupsController < ApplicationController
end
if authorized_action(@context, @current_user, :manage)
respond_to do |format|
format.json {
json = {
:pages => users.total_pages,
:current_page => users.current_page,
:next_page => users.next_page,
:previous_page => users.previous_page,
:total_entries => users.total_entries,
:users => users.map { |u| u.group_member_json(@context) }
}
json[:pagination_html] = render_to_string(:partial => 'user_pagination', :locals => { :users => users }) unless params[:no_html]
render :json => json
}
end
json = {
:pages => users.total_pages,
:current_page => users.current_page,
:next_page => users.next_page,
:previous_page => users.previous_page,
:total_entries => users.total_entries,
:users => users.map { |u| u.group_member_json(@context) }
}
json[:pagination_html] = render_to_string(:partial => 'user_pagination', :locals => { :users => users }) unless params[:no_html]
render :json => json
end
end

View File

@ -189,7 +189,7 @@ describe GroupsController do
@group = Account.default.groups.create!(:name => "some group")
@user = user(:active_all => true)
@group.add_user(@user)
delete 'remove_user', :group_id => @group.id, :user_id => @user.id
delete 'remove_user', :group_id => @group.id, :user_id => @user.id, :id => @user.id
assert_unauthorized
end
@ -197,7 +197,7 @@ describe GroupsController do
course_with_teacher_logged_in(:active_all => true)
@group = @course.groups.create!(:name => "PG 1", :group_category => @category)
@group.add_user(@user)
delete 'remove_user', :group_id => @group.id, :user_id => @user.id
delete 'remove_user', :group_id => @group.id, :user_id => @user.id, :id => @user.id
response.should be_success
@group.reload
@group.users.should be_empty