Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Headquarter < ApplicationRecord
- has_many :company_branches
- end
- class Branch < ApplicationRecord
- belongs_to :company_headquarter
- end
- RSpec.describe Headquarter, type: :model do
- it { should have_many(branches)}
- end
- RSpec.describe Branch, type: :model do
- it { should belong_to(:headquarter)}
- end
- RSpec.describe Company::Headquarter, type: :model do
- it { should have_many(:company_branches)}
- end
- Failure/Error: it { should have_many(:company_branches)}
- Expected Company::Headquarter to have a has_many association called company_branches (Company::Branch does not have a headquarter_id foreign key.)
Add Comment
Please, Sign In to add comment