test/integrations/agreement_test.rb in geocerts-0.0.25 vs test/integrations/agreement_test.rb in geocerts-1.0.0

- old
+ new

@@ -5,29 +5,24 @@ context 'GeoCerts::Agreement (using the API)' do context 'user agreement' do should 'return a GeoCerts::Agreement' do - managed_server_request :get, '/products.xml', :response => Responses::Product::All do - managed_server_request :get, '/products/Q/agreement.xml', :response => Responses::Agreement::Agreement do - assert_kind_of(GeoCerts::Agreement, GeoCerts::Product.find('Q').user_agreement) - end + VCR.use_cassette('product_agreement') do + assert_kind_of GeoCerts::Agreement, + GeoCerts::Product.find('Q').user_agreement end end should 'contain the server-provided agreement text' do - managed_server_request :get, '/products.xml', :response => Responses::Product::All do - managed_server_request :get, '/products/Q/agreement.xml', :response => Responses::Agreement::Agreement do - text = GeoCerts::Product.find('Q').user_agreement.text - assert_match(/GeoTrust\(R\) SSL Certificate Subscriber Agreement/, text) - assert_match(/YOU MUST READ THIS GEOTRUST SSL CERTIFICATE SUBSCRIBER AGREEMENT/, text) - assert_match(/GeoTrust SSL Certificate Subscriber Agreement Version 2.0/, text) - end + VCR.use_cassette('product_agreement') do + text = GeoCerts::Product.find('Q').user_agreement.text + assert_match(/SSL Certificate Subscriber Agreement/, text) end end should 'return an error for an unrecognized product code' do - managed_server_request :get, '/products/BAD/agreement.xml', :response => Responses::Agreement::UnrecognizedProduct do + VCR.use_cassette('product_agreement_404') do assert_responds_with_exception(GeoCerts::UnprocessableEntity, -90000) do GeoCerts::Product.new(:sku => 'BAD').user_agreement end end end