test/access/offer_test.rb in access-2.0.21 vs test/access/offer_test.rb in access-2.0.22

- old
+ new

@@ -85,6 +85,34 @@ assert offers_response.info.total_locations assert offers_response.info.total_stores end end + def test_offers_find_with_offer_uses_remaining + get_first_offer + VCR.use_cassette('offer find with offer uses remaining') do + offers_response = Access::Offer.find(@first_offer.offer_key, query: 'pizza', member_key: 'API_RUBY_GEM_TEST', uses_remaining: 'true') + first_offer = offers_response.offers.first + assert offers_response.success + assert_kind_of Access::OfferResponse, offers_response + assert_kind_of Access::Offer, first_offer + assert_kind_of Access::Redemption, first_offer.offer_uses_remaining + end + end + + def test_offer_uses_remaining + get_first_offer + VCR.use_cassette('redeem offer with redeem type for uses remaining test') do + Access::Redeem.redeem_offer(@first_offer.offer_key, @first_offer.redemption_methods.first, member_key: 'API_RUBY_GEM_TEST') + end + VCR.use_cassette('offer find uses remaining') do + offers_response = Access::Offer.find_uses_remaining(@first_offer.offer_key, member_key: 'API_RUBY_GEM_TEST') + first_offer = offers_response.offers.first + assert offers_response.success + assert_kind_of Access::OfferResponse, offers_response + assert_kind_of Access::Offer, first_offer + assert_kind_of Access::Redemption, first_offer.offer_uses_remaining + assert_equal @first_offer.offer_key, first_offer.offer_uses_remaining.offer_key + assert first_offer.offer_uses_remaining.uses_this_period + end + end end