test/access/favorite_test.rb in access-2.0.18 vs test/access/favorite_test.rb in access-2.0.19
- old
+ new
@@ -74,10 +74,17 @@
request = Access::Favorite.search_stores member_key: 'ALD12345'
assert_good_favorite_store_response(request)
end
end
+ def test_favorite_find
+ VCR.use_cassette('favorite find generic with offer') do
+ request = Access::Favorite.find @@offer.offer_key, favorite_type: 'offers', member_key: 'API_TEST'
+ assert_good_favorite_offer_response(request)
+ end
+ end
+
def test_favorite_find_offer
VCR.use_cassette('favorite find offer') do
Access::Favorite.create_offer @@offer.offer_key, member_key: 'API_TEST' # create it first, in case it was deleted
request = Access::Favorite.find_offer @@offer.offer_key, member_key: 'API_TEST'
assert_good_favorite_offer_response(request)
@@ -98,10 +105,17 @@
request = Access::Favorite.find_store @@offer.store.store_key, member_key: 'API_TEST'
assert_good_favorite_store_response(request)
end
end
+ def test_favorite_create
+ VCR.use_cassette('favorite create generic with offer') do
+ request = Access::Favorite.create @@offer.offer_key, favorite_type: 'offers', member_key: 'API_TEST'
+ assert_good_favorite_offer_response(request)
+ end
+ end
+
def test_favorite_create_offer
VCR.use_cassette('favorite create offer') do
request = Access::Favorite.create_offer @@offer.offer_key, member_key: 'API_TEST'
assert_good_favorite_offer_response(request)
end
@@ -120,10 +134,18 @@
request = Access::Favorite.create_store @@offer.store.store_key, member_key: 'API_TEST'
assert_good_favorite_store_response(request)
end
end
+ def test_favorite_delete
+ VCR.use_cassette('favorite delete generic with offer') do
+ request = Access::Favorite.delete @@offer.offer_key, favorite_type: 'offers', member_key: 'API_TEST'
+ assert request.success
+ assert_kind_of Access::FavoriteResponse, request
+ end
+ end
+
def test_favorite_delete_offer
VCR.use_cassette('favorite delete offer') do
Access::Favorite.create_offer @@offer.offer_key, member_key: 'API_TEST' # create it first, in case it was deleted
request = Access::Favorite.delete_offer @@offer.offer_key, member_key: 'API_TEST'
assert request.success
@@ -155,10 +177,10 @@
assert_kind_of Access::FavoriteResponse, request
assert_kind_of Array, request.favorites
assert_equal 1, request.favorites.map(&:favoriteType).uniq.count
assert_equal 'offer', request.favorites.map(&:favoriteType).uniq.first
assert_kind_of Access::Favorite, request.favorites.first
- assert_kind_of Access::Offer, request.favorites.first.offer unless request.favorites.first.offer.nil? # This test will go once the favorites api is pulling from elasticsearch
+ # assert_kind_of Access::Offer, request.favorites.first.offer if request.favorites.first.respond_to?('offer') # This test will go once the favorites api is pulling from elasticsearch
end
def assert_good_favorite_location_response(request)
assert request.success
assert_kind_of Access::FavoriteResponse, request