Sha256: 4265e79662fad635291c0543aa3a40f4199303695bec6b8cf2d12b8c1b58cbc5

Contents?: true

Size: 1.59 KB

Versions: 15

Compression:

Stored size: 1.59 KB

Contents

require 'test_helper'

class GeoCerts::AgreementTest < Test::Unit::TestCase
  
  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
        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
        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
          assert_responds_with_exception(GeoCerts::UnprocessableEntity, -90000) do
            GeoCerts::Product.new(:sku => 'BAD').user_agreement
          end
        end
      end
      
    end
    
  end
  
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
geocerts-0.0.25 test/integrations/agreement_test.rb
geocerts-0.0.24 test/integrations/agreement_test.rb
geocerts-0.0.23 test/integrations/agreement_test.rb
geocerts-0.0.22 test/integrations/agreement_test.rb
geocerts-0.0.21 test/integrations/agreement_test.rb
geocerts-0.0.20 test/integrations/agreement_test.rb
geocerts-0.0.19 test/integrations/agreement_test.rb
geocerts-0.0.18 test/integrations/agreement_test.rb
geocerts-0.0.17 test/integrations/agreement_test.rb
geocerts-0.0.16 test/integrations/agreement_test.rb
geocerts-0.0.15 test/integrations/agreement_test.rb
geocerts-0.0.14 test/integrations/agreement_test.rb
geocerts-0.0.13 test/integrations/agreement_test.rb
geocerts-0.0.12 test/integrations/agreement_test.rb
geocerts-0.0.11 test/integrations/agreement_test.rb