Sha256: feaf977f53b379d8caf0ba9648f1ac804a9d139567432e353c2903ac2f1b2ccb

Contents?: true

Size: 1.37 KB

Versions: 33

Compression:

Stored size: 1.37 KB

Contents

require './test/test_helper'

class RedeemTest < Minitest::Test

  def get_first_offer
    VCR.use_cassette('offer search') do
      @first_offer = Access::Offer.search(query: 'pizza', member_key: 'API_RUBY_GEM_TEST', per_page: 1).offers.first
    end
  end

  def test_redeem_offer_no_redeem_type
    get_first_offer
    VCR.use_cassette('redeem offer no redeem type') do
      redeem_response = Access::Redeem.redeem_offer(@first_offer.offer_key, nil, member_key: 'API_RUBY_GEM_TEST')
      assert redeem_response.success
      assert_kind_of Access::RedeemResponse, redeem_response
      assert_kind_of Array, redeem_response.links
      assert_kind_of Access::Link, redeem_response.links.first
      assert redeem_response.links.first.href
      assert redeem_response.links.first.rel
    end
  end


  def test_redeem_offer_with_redeem_type
    get_first_offer
    VCR.use_cassette('redeem offer with redeem type') do
      redeem_response = Access::Redeem.redeem_offer(@first_offer.offer_key, @first_offer.redemption_methods.first, member_key: 'API_RUBY_GEM_TEST')
      assert redeem_response.success
      assert_kind_of Access::RedeemResponse, redeem_response
      assert_kind_of Array, redeem_response.links
      assert redeem_response.content_type
      assert redeem_response.redemption_method
      assert redeem_response.details
      assert redeem_response.details.link
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
access-2.0.48 test/access/redeem_test.rb
access-2.0.47 test/access/redeem_test.rb
access-2.0.46 test/access/redeem_test.rb
access-2.0.44 test/access/redeem_test.rb
access-2.0.43 test/access/redeem_test.rb
access-2.0.42 test/access/redeem_test.rb
access-2.0.41 test/access/redeem_test.rb
access-2.0.40 test/access/redeem_test.rb
access-2.0.39 test/access/redeem_test.rb
access-2.0.38 test/access/redeem_test.rb
access-2.0.37 test/access/redeem_test.rb
access-2.0.36 test/access/redeem_test.rb
access-2.0.34 test/access/redeem_test.rb
access-2.0.33 test/access/redeem_test.rb
access-2.0.32 test/access/redeem_test.rb
access-2.0.31 test/access/redeem_test.rb
access-2.0.30 test/access/redeem_test.rb
access-2.0.29 test/access/redeem_test.rb
access-2.0.28 test/access/redeem_test.rb
access-2.0.27 test/access/redeem_test.rb