diff options
Diffstat (limited to 'spec/helpers/avatars_helper_spec.rb')
-rw-r--r-- | spec/helpers/avatars_helper_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/helpers/avatars_helper_spec.rb b/spec/helpers/avatars_helper_spec.rb index 047a6ca0b7d..7190f2fcd4a 100644 --- a/spec/helpers/avatars_helper_spec.rb +++ b/spec/helpers/avatars_helper_spec.rb @@ -7,7 +7,7 @@ RSpec.describe AvatarsHelper do let_it_be(:user) { create(:user) } - describe '#project_icon & #group_icon' do + describe '#project_icon, #group_icon, #topic_icon' do shared_examples 'resource with a default avatar' do |source_type| it 'returns a default avatar div' do expect(public_send("#{source_type}_icon", *helper_args)) @@ -71,6 +71,18 @@ RSpec.describe AvatarsHelper do let(:helper_args) { [resource] } end end + + context 'when providing a topic' do + it_behaves_like 'resource with a default avatar', 'topic' do + let(:resource) { create(:topic, name: 'foo') } + let(:helper_args) { [resource] } + end + + it_behaves_like 'resource with a custom avatar', 'topic' do + let(:resource) { create(:topic, avatar: File.open(uploaded_image_temp_path)) } + let(:helper_args) { [resource] } + end + end end describe '#avatar_icon_for' do |