Sha256: 4253b78cb226c02546e34d218b5850d6d0e2fc412213c835e40cb3be64d26151

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe Venice::PendingRenewalInfo do
  describe '.new' do
    let(:attributes) do
      {
        'auto_renew_product_id' => 'com.foo.product1',
        'original_transaction_id' => '37xxxxxxxxx89',
        'product_id' => 'com.foo.product1',
        'auto_renew_status' => '0',
        'is_in_billing_retry_period' => '0',
        'expiration_intent' => '1'
      }
    end

    subject(:pending_info) do
      described_class.new(attributes)
    end

    it 'parses the attributes correctly' do
      expect(subject.expiration_intent).to eql(1)
      expect(subject.auto_renew_status).to eql(0)
      expect(subject.auto_renew_product_id).to eql('com.foo.product1')
      expect(subject.is_in_billing_retry_period).to eql(false)
      expect(subject.product_id).to eql('com.foo.product1')
      expect(subject.original_json_data).to eql(attributes)
    end

    it 'outputs attributes in hash' do
      expect(subject.to_hash).to eql(expiration_intent: 1,
                                     auto_renew_status: 0,
                                     auto_renew_product_id: 'com.foo.product1',
                                     is_in_billing_retry_period: false,
                                     product_id: 'com.foo.product1',
                                     price_consent_status: nil,
                                     cancellation_reason: nil)
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
venice-0.6.0 spec/pending_renewal_info_spec.rb
folked-venice-0.5.0.1 spec/pending_renewal_info_spec.rb