correct spec to handle not null visibility_level
This commit is contained in:
parent
45c3ad5f91
commit
340a3ee5cb
|
@ -59,7 +59,11 @@ class Admin::GroupsController < Admin::AdminController
|
||||||
|
|
||||||
def save_group(group)
|
def save_group(group)
|
||||||
group.alias_level = group_params[:alias_level].to_i if group_params[:alias_level].present?
|
group.alias_level = group_params[:alias_level].to_i if group_params[:alias_level].present?
|
||||||
group.visibility_level = group_params[:visibility_level]
|
|
||||||
|
if group_params[:visibility_level]
|
||||||
|
group.visibility_level = group_params[:visibility_level]
|
||||||
|
end
|
||||||
|
|
||||||
grant_trust_level = group_params[:grant_trust_level].to_i
|
grant_trust_level = group_params[:grant_trust_level].to_i
|
||||||
group.grant_trust_level = (grant_trust_level > 0 && grant_trust_level <= 4) ? grant_trust_level : nil
|
group.grant_trust_level = (grant_trust_level > 0 && grant_trust_level <= 4) ? grant_trust_level : nil
|
||||||
|
|
||||||
|
|
|
@ -115,10 +115,7 @@ describe Admin::GroupsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "ignore name change on automatic group" do
|
it "ignore name change on automatic group" do
|
||||||
expect do
|
xhr :put, :update, { id: 1, group: { name: "WAT" } }
|
||||||
xhr :put, :update, { id: 1, group: { name: "WAT" } }
|
|
||||||
end.to change { GroupHistory.count }.by(1)
|
|
||||||
|
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
|
|
||||||
group = Group.find(1)
|
group = Group.find(1)
|
||||||
|
|
Loading…
Reference in New Issue