-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3345 from lgalis/user_no_group_validation_fix
Update the User data only if the validation passes (cherry picked from commit fbcf766) https://bugzilla.redhat.com/show_bug.cgi?id=1552873
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,25 @@ | |
expect(flash_messages.first[:message]).to eq("A User must be assigned to a Group") | ||
expect(flash_messages.first[:level]).to eq(:error) | ||
end | ||
|
||
it 'does not update the user without validation' do | ||
user1 = FactoryGirl.create(:user, :name => "User1", :userid => "User1", :miq_groups => [group], :email => "[email protected]") | ||
|
||
session[:edit] = {:key => "rbac_user_edit__#{user1.id}", | ||
:new => {:name => 'test8', | ||
:userid => 'test8', | ||
:email => '[email protected]', | ||
:group => nil, | ||
:password => 'test8', | ||
:verify => 'test8'}} | ||
expect(controller).to receive(:render_flash) | ||
post :rbac_user_edit, :params => {:button => 'save', :id => user1.id} | ||
flash_messages = assigns(:flash_array) | ||
expect(flash_messages.first[:message]).to eq("A User must be assigned to a Group") | ||
expect(flash_messages.first[:level]).to eq(:error) | ||
expect(user1.miq_groups).to eq([group]) | ||
expect(user1.name).to eq('User1') | ||
end | ||
end | ||
|
||
context "#db_backup" do | ||
|