summaryrefslogtreecommitdiff
path: root/spec/controllers/groups
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-05-06 14:33:39 -0700
committerStan Hu <stanhu@gmail.com>2015-05-07 10:00:35 -0700
commitbf4b4384590c271d1dfadf874d185c2f6130ad0e (patch)
tree8b83f49680900b3d91fbeba28f65c28ed1245dbb /spec/controllers/groups
parent415648e2555e25d30f64f4c2642cf149f6965859 (diff)
downloadgitlab-ce-bf4b4384590c271d1dfadf874d185c2f6130ad0e.tar.gz
Fix bug where avatar filenames were not actually deleted from the database during removal.
This would result in a 404 error in certain views. The `save` call was being rolled back due to an error in the validation step. Relax the validation step so that this works. Closes #1570
Diffstat (limited to 'spec/controllers/groups')
-rw-r--r--spec/controllers/groups/avatars_controller_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/controllers/groups/avatars_controller_spec.rb b/spec/controllers/groups/avatars_controller_spec.rb
new file mode 100644
index 00000000000..3dac134a731
--- /dev/null
+++ b/spec/controllers/groups/avatars_controller_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe Groups::AvatarsController do
+ let(:user) { create(:user) }
+ let(:group) { create(:group, owner: user, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) }
+
+ before do
+ sign_in(user)
+ end
+
+ it 'destroy should remove avatar from DB' do
+ delete :destroy, group_id: group.path
+ @group = assigns(:group)
+ expect(@group.avatar.present?).to be_falsey
+ expect(@group).to be_valid
+ end
+end