Commit 0879ca77 authored by marcheing's avatar marcheing Committed by Diego de Araújo Martinez Camarinha

Add content and encoded content relations

parent 92f813ea
......@@ -12,6 +12,8 @@ class Content < ApplicationRecord
after_create :send_to_zencoder
has_many :encoded_contents
private
def send_to_zencoder
......
......@@ -5,5 +5,7 @@ class EncodedContent < ApplicationRecord
s3_region: AWSSettings.aws_region
validates_attachment :video, presence: true
validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
belongs_to :content
end
......@@ -16,6 +16,10 @@ RSpec.describe Content, type: :model do
rejecting('text/plain', 'text/xml', 'image/png', 'image/gif') }
end
describe 'relations' do
it { should have_many(:encoded_contents) }
end
describe 'hooks' do
context 'after create' do
subject { build(:video) }
......
require 'rails_helper'
RSpec.describe EncodedContent, type: :model do
describe 'relations' do
it { should belong_to(:content) }
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment