Sha256: 30f1532f4406b6adbd577fac7f510747097ed0c4bb35b24416a0abede0f63210

Contents?: true

Size: 1.19 KB

Versions: 22

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe 'Apple Pay Domain Verification', type: :request do
  let(:domain_verification_certificate) { FFaker::Lorem.characters(20) }
  let(:stripe_apple_pay_payment_method) do
    Spree::Gateway::StripeApplePayGateway.create!(
      name: 'ApplePay',
      preferred_domain_verification_certificate: domain_verification_certificate
    )
  end
  let(:execute) { get '/.well-known/apple-developer-merchantid-domain-association' }

  shared_examples 'returns 404' do
    it 'returns RecordNotFound exception' do
      expect { execute }.to raise_exception(ActiveRecord::RecordNotFound)
    end
  end

  context 'apple pay gateway exists' do
    before do
      stripe_apple_pay_payment_method
      execute
    end

    it 'returns 200 HTTP status' do
      expect(response.status).to eq(200)
    end

    it 'renders domain verification certificate' do
      expect(response.body).to eq domain_verification_certificate
    end
  end

  context 'apple pay gateway doesnt exist' do
    it_behaves_like 'returns 404'
  end

  context 'apple pay gateway not active' do
    before do
      stripe_apple_pay_payment_method.update_column(:active, false)
    end

    it_behaves_like 'returns 404'
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
spree_gateway-3.11.0 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.10.0 spec/requests/apple_pay_domain_verification.rb
archetype_spree_gateway-3.9.5.1 spec/requests/apple_pay_domain_verification.rb
archetype_spree_gateway-3.9.5 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.9.4 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.9.3 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.9.2 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.9.0 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.8.0 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.7.5 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.7.4 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.7.3 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.7.2 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.7.1 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.7.0 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.6.7 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.6.5 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.6.4 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.6.1 spec/requests/apple_pay_domain_verification.rb
spree_gateway-3.6.0 spec/requests/apple_pay_domain_verification.rb