Add coverage for media#player, move body class to view (#31790)
				
					
				
			This commit is contained in:
		
							parent
							
								
									b530fc5267
								
							
						
					
					
						commit
						4f81ad2494
					
				| @ -19,9 +19,7 @@ class MediaController < ApplicationController | |||||||
|     redirect_to @media_attachment.file.url(:original) |     redirect_to @media_attachment.file.url(:original) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def player |   def player; end | ||||||
|     @body_classes = 'player' |  | ||||||
|   end |  | ||||||
| 
 | 
 | ||||||
|   private |   private | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -2,6 +2,8 @@ | |||||||
|   = render_initial_state |   = render_initial_state | ||||||
|   = javascript_pack_tag 'public', crossorigin: 'anonymous' |   = javascript_pack_tag 'public', crossorigin: 'anonymous' | ||||||
| 
 | 
 | ||||||
|  | - content_for :body_classes, 'player' | ||||||
|  | 
 | ||||||
| :ruby | :ruby | ||||||
|   meta = @media_attachment.file.meta || {} |   meta = @media_attachment.file.meta || {} | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										23
									
								
								spec/system/media_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								spec/system/media_spec.rb
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
|  | require 'rails_helper' | ||||||
|  | 
 | ||||||
|  | RSpec.describe 'Media' do | ||||||
|  |   describe 'Player page' do | ||||||
|  |     context 'when signed in' do | ||||||
|  |       before { sign_in Fabricate(:user) } | ||||||
|  | 
 | ||||||
|  |       it 'visits the media player page and renders the media' do | ||||||
|  |         status = Fabricate :status | ||||||
|  |         media = Fabricate :media_attachment, type: :video | ||||||
|  |         status.media_attachments << media | ||||||
|  | 
 | ||||||
|  |         visit medium_player_path(media) | ||||||
|  | 
 | ||||||
|  |         expect(page) | ||||||
|  |           .to have_css('body', class: 'player') | ||||||
|  |           .and have_css('div[data-component="Video"]') | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | end | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user