diff options
author | HombreLaser <sebastian-440@live.com> | 2023-04-01 12:00:33 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-04-01 12:00:33 -0600 |
commit | 753bf8499ba5d8815db8d08a1dcf69caa20660cf (patch) | |
tree | c758e18e3009f9c6da002164686e88956430847b /spec/models | |
parent | 64214e370778dc3efdaca85acd0cd7a569a79b81 (diff) |
Mejora estructura del proyecto
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/product_review_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
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 |