Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-13 01:28:47 +0300
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-13 01:28:47 +0300
commit2fe69158f0492496f301fe2bf0ee78d9a5448ce1 (patch)
tree816838cda6926532fc3a9369de79414a12276600 /spec
parent1c3997a7472bbbde1aebc0c952651f19f52cdd18 (diff)
parentbf0c04e5ff61cd68177e52c15128aea9b1a41427 (diff)
Merge branch 'group-icon-performance' into 'master'
Prevent database query each time we render group avatar Fixes #2118 See merge request !1688
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/application_helper_spec.rb18
-rw-r--r--spec/helpers/groups_helper.rb21
2 files changed, 21 insertions, 18 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 99ff8a32ea5..4c11709ed6e 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -39,24 +39,6 @@ describe ApplicationHelper do
end
end
- describe 'group_icon' do
- avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png')
-
- it 'should return an url for the avatar' do
- group = create(:group)
- group.avatar = File.open(avatar_file_path)
- group.save!
- expect(group_icon(group.path).to_s).
- to match("/uploads/group/avatar/#{ group.id }/gitlab_logo.png")
- end
-
- it 'should give default avatar_icon when no avatar is present' do
- group = create(:group)
- group.save!
- expect(group_icon(group.path)).to match('group_avatar.png')
- end
- end
-
describe 'project_icon' do
avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png')
diff --git a/spec/helpers/groups_helper.rb b/spec/helpers/groups_helper.rb
new file mode 100644
index 00000000000..3e99ab84ec9
--- /dev/null
+++ b/spec/helpers/groups_helper.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe GroupsHelper do
+ describe 'group_icon' do
+ avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png')
+
+ it 'should return an url for the avatar' do
+ group = create(:group)
+ group.avatar = File.open(avatar_file_path)
+ group.save!
+ expect(group_icon(group.path).to_s).
+ to match("/uploads/group/avatar/#{ group.id }/gitlab_logo.png")
+ end
+
+ it 'should give default avatar_icon when no avatar is present' do
+ group = create(:group)
+ group.save!
+ expect(group_icon(group.path)).to match('group_avatar.png')
+ end
+ end
+end