Guest User

Untitled

a guest
Nov 27th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.50 KB | None | 0 0
  1. it "should update state to exclusive if box is posted at end of book drive" do
  2. time_travel_to Time.parse("June 15 2011 11:55pm PDT")
  3. @p2 = Factory(:package, :parent => @parent, :kid => @child, :state => "unlisted")
  4. @p2.package_type = PackageType.find(4)
  5. <<<<<<< HEAD
  6. book = Category.find(BOOKS_CATEGORY)
  7. =======
  8. book = Category.find(152)
  9. >>>>>>> [FEATURE] built back end functionality for book drive seed phase, added book club badge to badge.rb, updated specs, added book_drive and book_swap phases to holiday model, added new toy box constants to constants.rb
  10. 5.times do @p2.categories << book end
  11. @p2.save
  12. @p2.list!
  13. time_travel_to @p2.exclusive_time + 10.minutes
  14. @p2.list!
  15. @p2.should be_exclusive
  16. @p2.should_not be_staged
  17. end
  18. it "should award book club badge if qualifying box is posted during book drive phase" do
  19. @parent.has_badge?(Badge::Type::BOOKCLUB).should be_true
  20. end
  21. <<<<<<< HEAD
  22. it "should award a book listing credit if qualifying box is posted during book drive phase and activate after two weeks without review" do
  23. @picker = Factory(:user)
  24. @address = Address.new(VALID_ADDRESS_SEED)
  25. @address.user = @picker
  26. @address.save
  27.  
  28. # first, check to make sure that the box lister got a book drive credit from posting during book drive
  29. CashCredit.pending_credit_balance_for_user(@parent).should be == 500
  30. @parent.cash_credits.first.credit_type.should == CashCredit::CreditType::LISTED_BOOK_DRIVE_BOX
  31.  
  32. # jump to the future (so that the package is pickable) and simulate pick flow
  33. time_travel_to Time.parse("June 16 2011 1:00 PDT")
  34. @p.list!
  35. @p.recipient = @picker
  36. @p.pick!
  37. @p.reserve!
  38. @p.paid!
  39. @p.confirm!
  40. @p.ship!
  41. @p.received!
  42.  
  43. # jump to the future and make sure credits are activated if no review is posted within 2 weeks
  44. time_travel_to 16.days.from_now
  45. Package.deliver_review_reminders
  46. CashCredit.pending_credit_balance_for_user(@parent).should be == 0
  47. CashCredit.credit_balance_for_user(@parent).should be == 500
  48. end
  49.  
  50. it "should award a book listing credit if qualifying box is posted during book drive phase and activate after review of 3 or more stars" do
  51. @picker = Factory(:user)
  52. @address = Address.new(VALID_ADDRESS_SEED)
  53. @address.user = @picker
  54. @address.save
  55.  
  56. # first, check to make sure that the box lister got a book drive credit from posting during book drive
  57. CashCredit.pending_credit_balance_for_user(@parent).should be == 500
  58. @parent.cash_credits.first.credit_type.should == CashCredit::CreditType::LISTED_BOOK_DRIVE_BOX
  59.  
  60. # jump to the future (so that the package is pickable) and simulate pick flow
  61. time_travel_to Time.parse("June 16 2011 1:00 PDT")
  62. @p.list!
  63. @p.recipient = @picker
  64. @p.pick!
  65. @p.reserve!
  66. @p.paid!
  67. @p.confirm!
  68. @p.ship!
  69. @p.received!
  70.  
  71. @p.update_attributes(review_stars: 3, review_stylies: 8)
  72. @p.review!
  73. CashCredit.pending_credit_balance_for_user(@parent).should be == 0
  74. CashCredit.credit_balance_for_user(@parent).should be == 500
  75. end
  76.  
  77. it "should award a book listing credit if qualifying box is posted during book drive phase but not activate after review of less than 3 stars" do
  78. @picker = Factory(:user)
  79. @address = Address.new(VALID_ADDRESS_SEED)
  80. @address.user = @picker
  81. @address.save
  82.  
  83. # first, check to make sure that the box lister got a book drive credit from posting during book drive
  84. CashCredit.pending_credit_balance_for_user(@parent).should be == 500
  85. @parent.cash_credits.first.credit_type.should == CashCredit::CreditType::LISTED_BOOK_DRIVE_BOX
  86.  
  87. # jump to the future (so that the package is pickable) and simulate pick flow
  88. time_travel_to Time.parse("June 16 2011 1:00 PDT")
  89. @p.list!
  90. @p.recipient = @picker
  91. @p.pick!
  92. @p.reserve!
  93. @p.paid!
  94. @p.confirm!
  95. @p.ship!
  96. @p.received!
  97.  
  98. @p.update_attributes(review_stars: 2, review_stylies: 8)
  99. @p.review!
  100. CashCredit.pending_credit_balance_for_user(@parent).should be == 0
  101. CashCredit.credit_balance_for_user(@parent).should be == 0
  102. end
  103. =======
  104. >>>>>>> [FEATURE] built back end functionality for book drive seed phase, added book club badge to badge.rb, updated specs, added book_drive and book_swap phases to holiday model, added new toy box constants to constants.rb
  105. end
  106.  
  107. describe "toy box type" do
  108. before(:each) do
  109. @p = Factory(:package, :parent => @parent, :kid => @child, :state => "unlisted")
  110. @p.list!
  111. end
  112. it "should be mostly toys" do
  113. @p.package_type = PackageType.find(4)
  114. toy = Category.find(TOYS_CATEGORY)
  115. 25.times do @p.categories << toy end
  116. @p.save
  117. @p.list!
  118. <<<<<<< HEAD
  119. @p.compute_toy_box_type.should == OTHER_TOYS
  120. =======
  121. @p.compute_toy_box_type.should == MOSTLY_TOYS
  122. >>>>>>> [FEATURE] built back end functionality for book drive seed phase, added book club badge to badge.rb, updated specs, added book_drive and book_swap phases to holiday model, added new toy box constants to constants.rb
  123. end
Add Comment
Please, Sign In to add comment