about summary refs log tree commit diff
path: root/spec/support
diff options
context:
space:
mode:
authorAkihiko Odaki (@fn_aki@pawoo.net) <akihiko.odaki.4i@stu.hosei.ac.jp>2017-06-23 01:34:27 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-06-22 18:34:27 +0200
commite27f792c24d1040246bc6ae890e6052f763cdb84 (patch)
treee972824755126f84735d0f8757da289c51589c90 /spec/support
parent98fab24beada0bb681a25d9a48918f3ea903a90a (diff)
Some minor change and spec for Account (#3813)
* Introduce domains method to Account relation

Account had followers_domains method, which was excessively specific.
Let relation of Account have domains method instead.

* Move follow_mapping in Account to AccountInteractions

* Introduce shared examples for AccountAvatar inclusion

* Cover Account more
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/examples/models/concerns/account_avatar.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/support/examples/models/concerns/account_avatar.rb b/spec/support/examples/models/concerns/account_avatar.rb
new file mode 100644
index 000000000..f2a8a2459
--- /dev/null
+++ b/spec/support/examples/models/concerns/account_avatar.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+shared_examples 'AccountAvatar' do |fabricator|
+  describe 'static avatars' do
+    describe 'when GIF' do
+      it 'creates a png static style' do
+        account = Fabricate(fabricator, avatar: attachment_fixture('avatar.gif'))
+        expect(account.avatar_static_url).to_not eq account.avatar_original_url
+      end
+    end
+
+    describe 'when non-GIF' do
+      it 'does not create extra static style' do
+        account = Fabricate(fabricator, avatar: attachment_fixture('attachment.jpg'))
+        expect(account.avatar_static_url).to eq account.avatar_original_url
+      end
+    end
+  end
+end