Sha256: f46c75d619fe71c3d96874f8d1b79c817c4d803c7ce9d5ebd640787b6d708942
Contents?: true
Size: 661 Bytes
Versions: 3
Compression:
Stored size: 661 Bytes
Contents
module ShoppingCart RSpec.describe Coupon, type: :model do subject(:coupon) { create :coupon } describe 'validations' do it { should belong_to :order } it { should validate_presence_of :code } it { should validate_presence_of :discount } describe 'when discount is' do context 'less than 0 it' do it 'should be invalid' do expect(build :coupon, discount: -10).not_to be_valid end end context 'greater than 100' do it 'should be invalid' do expect(build :coupon, discount: 120).not_to be_valid end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
shopping-cart-0.1.2 | spec/models/shopping_cart/coupon_spec.rb |
shopping-cart-0.1.1 | spec/models/shopping_cart/coupon_spec.rb |
shopping-cart-0.1.0 | spec/models/shopping_cart/coupon_spec.rb |