From 6c933857f4e7ac3b29d7a5aa620a78b7674a7f3d Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 29 Nov 2016 14:57:21 +0100 Subject: [PATCH] fix statistics generation with cash coupon --- .../{coupon_apply_service.rb => coupon_service.rb} | 0 ...on_apply_service_test.rb => coupon_service_test.rb} | 10 +++++----- 2 files changed, 5 insertions(+), 5 deletions(-) rename app/services/{coupon_apply_service.rb => coupon_service.rb} (100%) rename test/services/{coupon_apply_service_test.rb => coupon_service_test.rb} (60%) diff --git a/app/services/coupon_apply_service.rb b/app/services/coupon_service.rb similarity index 100% rename from app/services/coupon_apply_service.rb rename to app/services/coupon_service.rb diff --git a/test/services/coupon_apply_service_test.rb b/test/services/coupon_service_test.rb similarity index 60% rename from test/services/coupon_apply_service_test.rb rename to test/services/coupon_service_test.rb index 3286d6748..f42db7f9c 100644 --- a/test/services/coupon_apply_service_test.rb +++ b/test/services/coupon_service_test.rb @@ -1,28 +1,28 @@ require 'test_helper' -class CouponApplyServiceTest < ActiveSupport::TestCase +class CouponServiceTest < ActiveSupport::TestCase setup do @jdupond = User.find_by(username: 'jdupond') @cash_coupon = Coupon.find_by(code: 'ZERG6H1R65H') end test 'user apply percent coupon to cart' do - total = CouponApplyService.new.(1000, 'SUNNYFABLAB', @jdupond.id) + total = CouponService.new.(1000, 'SUNNYFABLAB', @jdupond.id) assert_equal 850, total end test 'user cannot apply excessive coupon to cart' do - total = CouponApplyService.new.(1000, @cash_coupon, @jdupond.id) + total = CouponService.new.(1000, @cash_coupon, @jdupond.id) assert_equal 1000, total end test 'user cannot apply invalid coupon to cart' do - total = CouponApplyService.new.(1000, 'INVALIDCODE', @jdupond.id) + total = CouponService.new.(1000, 'INVALIDCODE', @jdupond.id) assert_equal 1000, total end test 'user cannot apply expired coupon to cart' do - total = CouponApplyService.new.(1000, 'XMAS10', @jdupond.id) + total = CouponService.new.(1000, 'XMAS10', @jdupond.id) assert_equal 1000, total end end