From 4b9a74de98e68bb7a32fd1ab1354ac8eeeb86caa Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Fri, 25 Jan 2019 17:27:29 -0600 Subject: [PATCH] Remove VCR --- Gemfile | 1 - Gemfile.lock | 5 +- .../construct_billing_subscription_spec.rb | 81 ------------------- 3 files changed, 1 insertion(+), 86 deletions(-) delete mode 100644 spec/lib/construct/construct_billing_subscription_spec.rb diff --git a/Gemfile b/Gemfile index c52d6d72..d4ddd4db 100755 --- a/Gemfile +++ b/Gemfile @@ -132,7 +132,6 @@ group :development, :ci, :test do end group :test do - gem 'vcr' gem 'webmock' end diff --git a/Gemfile.lock b/Gemfile.lock index 3b48f874..4d835b71 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,7 +39,6 @@ PATH activerecord (>= 3.0) colorize (~> 0.8) - GEM remote: https://rubygems.org/ specs: @@ -421,7 +420,6 @@ GEM unf_ext unf_ext (0.0.7.2) unicode_utils (1.4.0) - vcr (2.9.3) virtus (1.0.5) axiom-types (~> 0.1) coercible (~> 1.0) @@ -516,11 +514,10 @@ DEPENDENCIES traceroute uglifier unf - vcr webmock RUBY VERSION ruby 2.3.7p456 BUNDLED WITH - 1.16.4 + 1.17.3 diff --git a/spec/lib/construct/construct_billing_subscription_spec.rb b/spec/lib/construct/construct_billing_subscription_spec.rb deleted file mode 100644 index 81e0c1cf..00000000 --- a/spec/lib/construct/construct_billing_subscription_spec.rb +++ /dev/null @@ -1,81 +0,0 @@ -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -require 'spec_helper' -require 'construct/construct_billing_subscription' - -describe ConstructBillingSubscription, :pending => true do - - let(:bp) do - bp = double("BillingPlan", {id: 1, stripe_plan_id: 'kitchen_sink'}) - return bp - end - - let(:cust_id) do - tok = VCR.use_cassette 'ConstructBillingSubscription/card_tok' do - Stripe::Token.create({card: { - number: '4242424242424242', - exp_month: 12, - exp_year: 2025, - cvc: '123' - }}).id - end - VCR.use_cassette 'ConstructBillingSubscription/cust_id' do - Stripe::Customer.create( - description: 'Test spec customer for ConstructBillingSubscription/cust_id', - source: tok - ).id - end - end - - describe '.with_stripe' do - - let(:np) do - card = double("Card", stripe_customer_id: cust_id) - np = double("Nonprofit", id: 1, created_at: Time.current, card: card) - allow(np).to receive(:currently_in_trial?).and_return(false) - np - end - - context 'when valid' do - let(:bs) do - VCR.use_cassette 'ConstructBillingSubscription/bs' do - ConstructBillingSubscription.with_stripe(np, bp) - end - end - - it 'sets the billing_plan_id' do - expect(bs[:billing_plan_id]).to eq bp.id - end - - it 'sets the stripe subscription id' do - expect(bs[:stripe_subscription_id]).to match /^sub_/ - end - - it 'sets the status as active' do - expect(bs[:status]).to eq 'active' - end - end - - context 'when invalid' do - it 'throws an exception with invalid stripe customer id' do - allow(np).to receive_message_chain(:card, :stripe_customer_id).and_return('xxx') - expect do - VCR.use_cassette 'ConstructBillingSubscription/invalid_customer' do - ConstructBillingSubscription.with_stripe(np, bp) - end - end.to raise_exception(Stripe::InvalidRequestError) - end - - it 'throws an exception with invalid stripe plan id' do - allow(bp).to receive(:stripe_plan_id).and_return('xxx') - expect do - VCR.use_cassette 'ConstructBillingSubscription/invalid_plan' do - ConstructBillingSubscription.with_stripe(np, bp) - end - end.to raise_exception(Stripe::InvalidRequestError) - end - end - - end - -end -