summaryrefslogtreecommitdiff
path: root/spec/models/product_review_spec.rb
blob: f4e49997c1acc883a0019c0d338b7e30bc3babfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'rails_helper'

RSpec.describe ProductReview, type: :model do
  let(:review) { build(:product_review) }

  it { should validate_presence_of(:review) }
  it { should validate_presence_of(:rating) }

  describe 'rating' do
    it 'cant be less than 1 or greater than 5' do
      review.rating = -1
      expect(review.save).to be_falsey
      review.rating = 6
      expect(review.save).to be_falsey
    end
  end
end