stripe-ruby-mock / stripe-ruby-mock

A mocking library for testing stripe ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StripeMock coercing Integers to Floats?

rossgeesman opened this issue · comments

I just upgraded from stripe-ruby-mock 2.4.0 to 3.0.1 and discovered that now Integer values are being returned as floats.

For example previously when on 2.4.0...

balance_transaction = Stripe::BalanceTransaction.retrieve('abc123')
balance_transaction.amount.class
=> Integer

After upgrading...

balance_transaction = Stripe::BalanceTransaction.retrieve('abc123')
balance_transaction.amount.class
=> Float

According to the stripe api docs, the amount should be an integer . It seems that the cause of the behavior is that the default conversion_rate value is 1.0 which is easy enough to override by calling StripeMock.set_conversion_rate before tests.

Is this expected behavior for stripe-ruby-mock or should it be changed? I would be happy to contribute a PR if a fix is warranted.