Update fabricator for MediaAttachment to attach a file according to type (#3862)
This fixes a random spec failures since commit
c8020b2105.
			
			
This commit is contained in:
		
							parent
							
								
									9bc32eb267
								
							
						
					
					
						commit
						baa248a801
					
				
					 1 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
					@ -1,4 +1,16 @@
 | 
				
			||||||
Fabricator(:media_attachment) do
 | 
					Fabricator(:media_attachment) do
 | 
				
			||||||
  account
 | 
					  account
 | 
				
			||||||
  file { [attachment_fixture(['attachment.gif', 'attachment.jpg', 'attachment.webm'].sample), nil].sample }
 | 
					  file do |attrs|
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					      case attrs[:type]
 | 
				
			||||||
 | 
					      when :gifv
 | 
				
			||||||
 | 
					        attachment_fixture ['attachment.gif', 'attachment.webm'].sample
 | 
				
			||||||
 | 
					      when :image
 | 
				
			||||||
 | 
					        attachment_fixture 'attachment.jpg'
 | 
				
			||||||
 | 
					      when nil
 | 
				
			||||||
 | 
					        attachment_fixture ['attachment.gif', 'attachment.jpg', 'attachment.webm'].sample
 | 
				
			||||||
 | 
					      end,
 | 
				
			||||||
 | 
					      nil
 | 
				
			||||||
 | 
					    ].sample
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue