This commit is contained in:
Vokhmin Alexey V 2015-05-26 02:35:00 +03:00
parent c14a33d0be
commit 5882cafa7e
4 changed files with 8 additions and 12 deletions

View File

@ -28,7 +28,8 @@ class Api::V1::GroupsController < Api::V1::BaseController
end
def create
@group = current_user.own_groups.new(group_params)
@group = current_user.own_groups.new
@group.assign_attributes(group_params)
create_subject @group
end
@ -50,7 +51,7 @@ class Api::V1::GroupsController < Api::V1::BaseController
private
def group_params
subject_params(Group)
subject_params(Group, @group)
end
# Private: before_action hook which loads Group.

View File

@ -43,7 +43,9 @@ class Groups::ProfileController < Groups::BaseController
end
def create
authorize @group = current_user.own_groups.build(group_params)
@group = current_user.own_groups.new
@group.assign_attributes(group_params)
authorize @group
if @group.save
flash[:notice] = t('flash.group.saved')
redirect_to group_path(@group)
@ -82,7 +84,7 @@ class Groups::ProfileController < Groups::BaseController
protected
def group_params
subject_params(Group)
subject_params(Group, @group)
end
def paginate_projects(page)

View File

@ -24,13 +24,6 @@ describe Comment do
set_commentable_data
end
context 'with mass assignment' do
it 'should not be able to update commentable' do
@comment.update_attributes({commentable_type: 'Grit::Commit', commentable_id: 0})
expect(@comment.reload.commentable).to eq(@issue)
end
end
context 'automatic issue linking' do
before(:each) do
@same_name_project = FactoryGirl.create(:project, name: @project.name)

View File

@ -44,7 +44,7 @@ describe Product do
params = {main_script: 'text.sh', project_version: product.project.default_branch}
product.update_attributes params.merge(autostart_status: Product::ONCE_A_12_HOURS)
FactoryGirl.create :product, params.merge(autostart_status: Product::ONCE_A_DAY)
FactoryGirl.create(:arch, name: 'x86_64')
FactoryGirl.build(:arch, name: 'x86_64').save
end
it 'should be created only one product_build_list' do