From 753bf8499ba5d8815db8d08a1dcf69caa20660cf Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Sat, 1 Apr 2023 12:00:33 -0600 Subject: Mejora estructura del proyecto --- spec/models/product_review_spec.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'spec/models') diff --git a/spec/models/product_review_spec.rb b/spec/models/product_review_spec.rb index 9dfbff2..f4e4999 100644 --- a/spec/models/product_review_spec.rb +++ b/spec/models/product_review_spec.rb @@ -1,5 +1,17 @@ require 'rails_helper' RSpec.describe ProductReview, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + 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 -- cgit v1.2.3