File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
app/services/cms/providers/strapi/factories
spec/services/cms/models/images Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -119,13 +119,13 @@ def self.to_enrichment(strapi_data)
119119 end
120120
121121 def self . to_featured_image ( strapi_data , _all_data , size = :large )
122- return nil if strapi_data [ :data ]
123-
122+ return nil unless strapi_data [ :data ] [ :attributes ]
123+ image_data = strapi_data [ :data ] [ :attributes ]
124124 {
125- url : strapi_data [ :url ] ,
126- alt : strapi_data [ :alternativeText ] ,
127- caption : strapi_data [ :caption ] ,
128- formats : strapi_data [ :formats ] ,
125+ url : image_data [ :url ] ,
126+ alt : image_data [ :alternativeText ] ,
127+ caption : image_data [ :caption ] ,
128+ formats : image_data [ :formats ] ,
129129 size :
130130 }
131131 end
Original file line number Diff line number Diff line change 1+ require "rails_helper"
2+
3+ RSpec . describe Cms ::Models ::Images ::FeaturedImage do
4+ it "should render a Cms::ImageComponent" do
5+ @comp = Cms ::Providers ::Strapi ::Factories ::ModelFactory . process_model (
6+ { model : Cms ::Models ::Images ::FeaturedImage , key : :featuredImage } ,
7+ { featuredImage : { data : Cms ::Mocks ::Images ::Image . generate_raw_data } }
8+ )
9+ expect ( @comp . render ) . to be_instance_of ( FeaturedImageComponent )
10+ end
11+ end
You can’t perform that action at this time.
0 commit comments