test/access/offer_test.rb in access-2.0.48 vs test/access/offer_test.rb in access-2.0.49
- old
+ new
@@ -1,19 +1,19 @@
require './test/test_helper'
class OfferTest < Minitest::Test
def get_first_offer
- VCR.use_cassette('offer search') do
+ VCR.use_cassette('offer/search_first') do
@first_offer = Access::Offer.search(query: 'pizza', member_key: 'API_RUBY_GEM_TEST', per_page: 1).offers.first
end
end
def test_offers_search
assert_equal Access.config.access_token, ENV['ACCESS_TOKEN']
- VCR.use_cassette('offer search') do
+ VCR.use_cassette('offer/search') do
offers_response = Access::Offer.search(query: 'pizza', member_key: 'API_RUBY_GEM_TEST', per_page: 1)
first_offer = offers_response.offers.first
assert offers_response.success
assert_kind_of Access::OfferResponse, offers_response
assert_kind_of Access::Link, offers_response.links
@@ -28,31 +28,31 @@
end
end
def test_offers_find
get_first_offer
- VCR.use_cassette('offer find') do
+ VCR.use_cassette('offer/find') do
offers_response = Access::Offer.find(@first_offer.offer_key, query: 'pizza', 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
end
end
def test_offers_extra_methods
- VCR.use_cassette('offer search') do
+ VCR.use_cassette('offer/search') do
offers_response = Access::Offer.search(query: 'pizza', member_key: 'API_RUBY_GEM_TEST', per_page: 1)
first_offer = offers_response.offers.first
assert offers_response.success
assert_equal first_offer.offer_store.physical_location, first_offer.location
assert_equal first_offer.offer_store, first_offer.store
end
end
def test_offers_fail_member_key
- VCR.use_cassette('offer search fail member key') do
+ VCR.use_cassette('offer/search_fail_member_key') do
offers_response = Access::Offer.search(query: 'pizza')
refute offers_response.success
assert_kind_of Access::OfferResponse, offers_response
assert_kind_of Access::Error, offers_response.error
assert_equal 401, offers_response.error.status_code
@@ -67,11 +67,11 @@
assert_raises(Access::Error::NoAccessToken) { Access::Offer.search(query: 'pizza', member_key: 'API_RUBY_GEM_TEST') }
Access.config.access_token = ENV['ACCESS_TOKEN'] = orginal_token
end
def test_offers_with_aggregation
- VCR.use_cassette('offer with aggregations') do
+ VCR.use_cassette('offer/with_aggregations') do
offers_response = Access::Offer.search(query: 'pizza', member_key: 'API_RUBY_GEM_TEST', aggregations: 'all_categories,stores,locations,redemption_methods')
assert offers_response.success
assert_kind_of Access::OfferResponse, offers_response
assert_kind_of Array, offers_response.offer_count_in_categories
assert_kind_of Access::Aggregations, offers_response.offer_count_in_categories.first
@@ -87,11 +87,11 @@
end
end
def test_offers_find_with_offer_uses_remaining
get_first_offer
- VCR.use_cassette('offer find with offer uses remaining') do
+ 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
@@ -99,13 +99,13 @@
end
end
def test_offer_uses_remaining
get_first_offer
- VCR.use_cassette('redeem offer with redeem type for uses remaining test') do
+ VCR.use_cassette('redeem/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
+ 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