Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. require 'rails_helper'
  2.  
  3. RSpec.describe Message, type: :model do
  4. before(:each) do
  5. @message = FactoryBot.build(:message)
  6. end
  7.  
  8. it "has a valid factory" do
  9. expect(build(:message)).to be_valid
  10. end
  11.  
  12. context "validation" do
  13. it "is valid with valid attributes" do
  14. expect(@message).to be_a(Message)
  15. end
  16.  
  17. describe "#body" do
  18. it {expect(@message).to validate_presence_of(:body)}
  19. end
  20. end
  21.  
  22. context "associations" do
  23. it { expect(@message).to belong_to(:user)}
  24. it { expect(@message).to belong_to(:conversation)}
  25. end
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement