Guest User

Untitled

a guest
Jan 21st, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. class Headquarter < ApplicationRecord
  2. has_many :company_branches
  3. end
  4.  
  5. class Branch < ApplicationRecord
  6. belongs_to :company_headquarter
  7. end
  8.  
  9. RSpec.describe Headquarter, type: :model do
  10. it { should have_many(branches)}
  11. end
  12.  
  13. RSpec.describe Branch, type: :model do
  14. it { should belong_to(:headquarter)}
  15. end
  16.  
  17. RSpec.describe Company::Headquarter, type: :model do
  18. it { should have_many(:company_branches)}
  19. end
  20.  
  21. Failure/Error: it { should have_many(:company_branches)}
  22. 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