diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-01-04 22:54:06 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-01-04 23:04:42 +0100 |
commit | 01eaeab56df4da4c697b1096f40a400cc9e2b8e8 (patch) | |
tree | 6288ee106b4615cacd98362f9fd268317a9cdeff /spec/models | |
parent | 22daf24600d8e99e4569740ee5836d25c70c1e8b (diff) | |
parent | 2ecc7802caf4d272191a7fd582fc97996f750827 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - `app/controllers/application_controller.rb`: Conflict due to theming system. - `app/controllers/oauth/authorizations_controller.rb`: Conflict due to theming system.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/account_spec.rb | 1 | ||||
-rw-r--r-- | spec/models/media_attachment_spec.rb | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index b2f6234cb..3cca9b343 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -823,4 +823,5 @@ RSpec.describe Account, type: :model do end include_examples 'AccountAvatar', :account + include_examples 'AccountHeader', :account end diff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb index 7ddfba7ed..a275621a1 100644 --- a/spec/models/media_attachment_spec.rb +++ b/spec/models/media_attachment_spec.rb @@ -133,6 +133,24 @@ RSpec.describe MediaAttachment, type: :model do expect(media.file.meta["small"]["height"]).to eq 327 expect(media.file.meta["small"]["aspect"]).to eq 490.0 / 327 end + + it 'gives the file a random name' do + expect(media.file_file_name).to_not eq 'attachment.jpg' + end + end + + describe 'base64-encoded jpeg' do + let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" } + let(:media) { MediaAttachment.create(account: Fabricate(:account), file: base64_attachment) } + + it 'saves media attachment' do + expect(media.persisted?).to be true + expect(media.file).to_not be_nil + end + + it 'gives the file a file name' do + expect(media.file_file_name).to_not be_blank + end end describe 'descriptions for remote attachments' do |