Sha256: 241a732bf0f6f685d1ad559da7e8795b4e0743285992058189c5cc3be60cbbd5

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

require "spec_helper"

describe 'Espago.subscriptions' do

  it "should get list of subscriptions" do
    VCR.use_cassette('subscriptions get') do
      response = Espago.subscriptions :get
      response.count.should eq(1)
      response.subscriptions.size.should eq(1)
    end
  end

  it "should get info abount subscriptions" do
    VCR.use_cassette('subscriptions get sub_8yYuCBKdywr7e2') do
      response = Espago.subscriptions :get,{subscription_id:'sub_8yYuCBKdywr7e2'}
      response.status.should eq(200)
      response.state.should eq('active')
      response.client.should eq('cli_90Pi6Jf0ndl_PP')
      response.plan.should eq('pl_12345')
      response.last_invoice.should be_kind_of(Hash)
    end
  end

  it "should get params from new plan" do
    VCR.use_cassette('subscriptions post') do
      response = Espago.subscriptions :post,{ plan:'pl_12345',client:'cli_90Pi6Jf0ndl_PP'}
      response.status.should eq(201)
      response.state.should eq('active')
      response.client.should eq('cli_90Pi6Jf0ndl_PP')
      response.plan.should eq('pl_12345')
      response.last_invoice.should be_kind_of(Hash)
    end
  end

  it "should get info after deleted subscription" do
    VCR.use_cassette('subscriptions delete sub_8yYuCBKdywr7e2') do
      response = Espago.subscriptions :delete,{subscription_id:'sub_8yYuCBKdywr7e2'}
      response.status.should eq(204)
    end
  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
espago-0.1.8 spec/features/subscriptions_spec.rb
espago-0.1.2 spec/features/subscriptions_spec.rb