Commit ae0b71aa authored by marcheing's avatar marcheing Committed by Rafael Reggiani Manzo

Add association between user and contents

parent 0b5021fc
......@@ -14,6 +14,8 @@ class Content < ApplicationRecord
has_many :encoded_contents
belongs_to :user
private
def send_to_zencoder
......
......@@ -8,4 +8,5 @@ class User < ApplicationRecord
validates :email, confirmation: true
has_one :profile
has_many :contents
end
......@@ -17,7 +17,8 @@ RSpec.describe Content, type: :model do
end
describe 'relations' do
it { should have_many(:encoded_contents) }
it { is_expected.to have_many(:encoded_contents) }
it { is_expected.to belong_to(:user) }
end
describe 'hooks' do
......
......@@ -3,5 +3,6 @@ require 'rails_helper'
RSpec.describe User, type: :model do
describe 'associations' do
it { is_expected.to have_one(:profile) }
it { is_expected.to have_many(:contents) }
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