diaspora/spec/presenters/avatar_presenter_spec.rb
Dennis Schubert dbbf743920
Add the scaled_full image as a raw image in AvatarPresenter as well.
This is a temporary workaround. Adding the real raw photo is quite a
challange and touches multiple components nobody wants to touch right
now. As this change is blocking an actual hotfix, this is fine, and will
be properly fixed at a later time.
2020-02-04 15:52:57 +01:00

28 lines
986 B
Ruby

# frozen_string_literal: true
describe AvatarPresenter do
describe "#base_hash" do
it "calls image_url() for the avatars" do
profile = FactoryGirl.create(:profile_with_image_url, person: alice.person)
presenter = AvatarPresenter.new(profile)
expect(profile).to receive(:image_url).exactly(4).times.and_call_original
expect(presenter.base_hash).to be_present
end
it "returns nothing if no images set" do
profile = FactoryGirl.create(:profile, person: alice.person)
presenter = AvatarPresenter.new(profile)
expect(presenter.base_hash).to be_nil
end
it "returns all relevant sizes" do
profile = FactoryGirl.create(:profile_with_image_url, person: alice.person)
base_hash = AvatarPresenter.new(profile).base_hash
expect(base_hash[:small]).to be_truthy
expect(base_hash[:medium]).to be_truthy
expect(base_hash[:large]).to be_truthy
expect(base_hash[:raw]).to be_truthy
end
end
end