These are chat archives for rebelidealist/stripe-ruby-mock

23rd
Dec 2015
kathyonu
@kathyonu
Dec 23 2015 15:52
@nomanurrehman Address them .. @alexmamonchik are you able to help @nomanurrehman ? Or, can you put out a call to all to see if anyone can help ?
Noman Ur Rehman
@nomanurrehman
Dec 23 2015 17:42
No idea how to ping everyone ...
kathyonu
@kathyonu
Dec 23 2015 17:54
only the admin can do it.
DaKaZ
@DaKaZ
Dec 23 2015 22:37

Hi, I am not sure if this is a bug or just not the correct way to use stripe-ruby-mock, but I have number of plans in our Rails backend, and for testing, I have this setup:

let(:plan) {
    sample_plan = Stripe::Plans.all.sample
    stripe_helper.create_plan(id: sample_plan.id, ammount: sample_plan.amount, currency: sample_plan.currency, interval: sample_plan.interval)
  }

so far, so good, but my controller takes the plan and does some more work (logging, invoice creation, etc like this:

plan = eval("Stripe::Plans::" + params[:plan].upcase)

but this gives me this error:

Stripe::InvalidRequestError:
       No such plan: guardian_monthly

So... my stripe mocking does not seem to actually have my plan... what am I missing?

DaKaZ
@DaKaZ
Dec 23 2015 23:53
Nevermind - I had stupid user errors - its working perfectly now
I switched my eval to this: plan = Stripe::Plan.retrieve(params[:plan])
much safer too ;)