diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-01-02 12:35:15 +0100 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-01-03 15:37:32 +0100 |
commit | ec273b8d069bf3f9a12a2ffde545398cd2967eeb (patch) | |
tree | 76e85434455ceec9cbad2ba8b8f10b8107e4d28a /spec | |
parent | 8dc2163ce580f1d71be1cf45e5dfcb2b4763d7bb (diff) | |
download | gitlab-ce-ec273b8d069bf3f9a12a2ffde545398cd2967eeb.tar.gz |
Copy, don't move uploaded avatar files
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/projects/fork_service_spec.rb | 13 | ||||
-rw-r--r-- | spec/uploaders/avatar_uploader_spec.rb | 8 |
2 files changed, 17 insertions, 4 deletions
diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb index 64d15c0523c..8e614211116 100644 --- a/spec/services/projects/fork_service_spec.rb +++ b/spec/services/projects/fork_service_spec.rb @@ -5,10 +5,12 @@ describe Projects::ForkService, services: true do before do @from_namespace = create(:namespace) @from_user = create(:user, namespace: @from_namespace ) + avatar = fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png") @from_project = create(:project, creator_id: @from_user.id, namespace: @from_namespace, star_count: 107, + avatar: avatar, description: 'wow such project') @to_namespace = create(:namespace) @to_user = create(:user, namespace: @to_namespace) @@ -36,6 +38,17 @@ describe Projects::ForkService, services: true do it { expect(to_project.namespace).to eq(@to_user.namespace) } it { expect(to_project.star_count).to be_zero } it { expect(to_project.description).to eq(@from_project.description) } + it { expect(to_project.avatar.file).to be_exists } + + # This test is here because we had a bug where the from-project lost its + # avatar after being forked. + # https://gitlab.com/gitlab-org/gitlab-ce/issues/26158 + it "after forking the from-project still has its avatar" do + # If we do not fork the project first we cannot detect the bug. + expect(to_project).to be_persisted + + expect(@from_project.avatar.file).to be_exists + end end end diff --git a/spec/uploaders/avatar_uploader_spec.rb b/spec/uploaders/avatar_uploader_spec.rb index 1f0e8732587..76f5a4b42ed 100644 --- a/spec/uploaders/avatar_uploader_spec.rb +++ b/spec/uploaders/avatar_uploader_spec.rb @@ -5,14 +5,14 @@ describe AvatarUploader do subject { described_class.new(user) } describe '#move_to_cache' do - it 'is true' do - expect(subject.move_to_cache).to eq(true) + it 'is false' do + expect(subject.move_to_cache).to eq(false) end end describe '#move_to_store' do - it 'is true' do - expect(subject.move_to_store).to eq(true) + it 'is false' do + expect(subject.move_to_store).to eq(false) end end end |