Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- it "should update state to exclusive if box is posted at end of book drive" do
- time_travel_to Time.parse("June 15 2011 11:55pm PDT")
- @p2 = Factory(:package, :parent => @parent, :kid => @child, :state => "unlisted")
- @p2.package_type = PackageType.find(4)
- <<<<<<< HEAD
- book = Category.find(BOOKS_CATEGORY)
- =======
- book = Category.find(152)
- >>>>>>> [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
- 5.times do @p2.categories << book end
- @p2.save
- @p2.list!
- time_travel_to @p2.exclusive_time + 10.minutes
- @p2.list!
- @p2.should be_exclusive
- @p2.should_not be_staged
- end
- it "should award book club badge if qualifying box is posted during book drive phase" do
- @parent.has_badge?(Badge::Type::BOOKCLUB).should be_true
- end
- <<<<<<< HEAD
- it "should award a book listing credit if qualifying box is posted during book drive phase and activate after two weeks without review" do
- @picker = Factory(:user)
- @address = Address.new(VALID_ADDRESS_SEED)
- @address.user = @picker
- @address.save
- # first, check to make sure that the box lister got a book drive credit from posting during book drive
- CashCredit.pending_credit_balance_for_user(@parent).should be == 500
- @parent.cash_credits.first.credit_type.should == CashCredit::CreditType::LISTED_BOOK_DRIVE_BOX
- # jump to the future (so that the package is pickable) and simulate pick flow
- time_travel_to Time.parse("June 16 2011 1:00 PDT")
- @p.list!
- @p.recipient = @picker
- @p.pick!
- @p.reserve!
- @p.paid!
- @p.confirm!
- @p.ship!
- @p.received!
- # jump to the future and make sure credits are activated if no review is posted within 2 weeks
- time_travel_to 16.days.from_now
- Package.deliver_review_reminders
- CashCredit.pending_credit_balance_for_user(@parent).should be == 0
- CashCredit.credit_balance_for_user(@parent).should be == 500
- end
- 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
- @picker = Factory(:user)
- @address = Address.new(VALID_ADDRESS_SEED)
- @address.user = @picker
- @address.save
- # first, check to make sure that the box lister got a book drive credit from posting during book drive
- CashCredit.pending_credit_balance_for_user(@parent).should be == 500
- @parent.cash_credits.first.credit_type.should == CashCredit::CreditType::LISTED_BOOK_DRIVE_BOX
- # jump to the future (so that the package is pickable) and simulate pick flow
- time_travel_to Time.parse("June 16 2011 1:00 PDT")
- @p.list!
- @p.recipient = @picker
- @p.pick!
- @p.reserve!
- @p.paid!
- @p.confirm!
- @p.ship!
- @p.received!
- @p.update_attributes(review_stars: 3, review_stylies: 8)
- @p.review!
- CashCredit.pending_credit_balance_for_user(@parent).should be == 0
- CashCredit.credit_balance_for_user(@parent).should be == 500
- end
- 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
- @picker = Factory(:user)
- @address = Address.new(VALID_ADDRESS_SEED)
- @address.user = @picker
- @address.save
- # first, check to make sure that the box lister got a book drive credit from posting during book drive
- CashCredit.pending_credit_balance_for_user(@parent).should be == 500
- @parent.cash_credits.first.credit_type.should == CashCredit::CreditType::LISTED_BOOK_DRIVE_BOX
- # jump to the future (so that the package is pickable) and simulate pick flow
- time_travel_to Time.parse("June 16 2011 1:00 PDT")
- @p.list!
- @p.recipient = @picker
- @p.pick!
- @p.reserve!
- @p.paid!
- @p.confirm!
- @p.ship!
- @p.received!
- @p.update_attributes(review_stars: 2, review_stylies: 8)
- @p.review!
- CashCredit.pending_credit_balance_for_user(@parent).should be == 0
- CashCredit.credit_balance_for_user(@parent).should be == 0
- end
- =======
- >>>>>>> [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
- end
- describe "toy box type" do
- before(:each) do
- @p = Factory(:package, :parent => @parent, :kid => @child, :state => "unlisted")
- @p.list!
- end
- it "should be mostly toys" do
- @p.package_type = PackageType.find(4)
- toy = Category.find(TOYS_CATEGORY)
- 25.times do @p.categories << toy end
- @p.save
- @p.list!
- <<<<<<< HEAD
- @p.compute_toy_box_type.should == OTHER_TOYS
- =======
- @p.compute_toy_box_type.should == MOSTLY_TOYS
- >>>>>>> [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
- end
Add Comment
Please, Sign In to add comment