summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/product_review_spec.rb14
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