diff --git a/app/models/alaveteli_pro/price.rb b/app/models/alaveteli_pro/price.rb index 6ccdf54c39..6bec30061f 100644 --- a/app/models/alaveteli_pro/price.rb +++ b/app/models/alaveteli_pro/price.rb @@ -7,9 +7,8 @@ class AlaveteliPro::Price < SimpleDelegator tax :unit_amount def self.list - AlaveteliConfiguration.stripe_prices.inject([]) do |arr, (_key, id)| - arr << retrieve(id) - arr + AlaveteliConfiguration.stripe_prices.map do |(_key, id)| + retrieve(id) end end @@ -21,7 +20,7 @@ def self.retrieve(id) end def to_param - AlaveteliConfiguration.stripe_prices[id] + AlaveteliConfiguration.stripe_prices[id] || id end # product diff --git a/spec/controllers/alaveteli_pro/subscriptions_controller_spec.rb b/spec/controllers/alaveteli_pro/subscriptions_controller_spec.rb index 00849cfb97..98bfbdf76d 100644 --- a/spec/controllers/alaveteli_pro/subscriptions_controller_spec.rb +++ b/spec/controllers/alaveteli_pro/subscriptions_controller_spec.rb @@ -752,7 +752,6 @@ let(:user) { FactoryBot.create(:pro_user) } let!(:customer) do - price = stripe_helper.create_price(id: 'test', product: product.id) customer = Stripe::Customer.create( email: user.email, source: stripe_helper.generate_card_token @@ -822,8 +821,6 @@ context 'with a signed-in user' do let(:user) { FactoryBot.create(:pro_user) } - let(:price) { stripe_helper.create_price(id: 'test', product: product.id) } - let(:customer) do customer = Stripe::Customer.create({ email: user.email, diff --git a/spec/views/alaveteli_pro/plans/index.html.erb_spec.rb b/spec/views/alaveteli_pro/plans/index.html.erb_spec.rb index ccff9152fc..eaba2f75c1 100644 --- a/spec/views/alaveteli_pro/plans/index.html.erb_spec.rb +++ b/spec/views/alaveteli_pro/plans/index.html.erb_spec.rb @@ -12,7 +12,7 @@ let(:stripe_price) do stripe_helper.create_price( - id: 'pro', product: product.id, unit_amount: cents_price + id: 'price_123', product: product.id, unit_amount: cents_price ) end