13 Commits

Author SHA1 Message Date
Brandur
b9a3971df8 Move file upload tests over to be handled by stripe-mock
`stripe-mock` can now respond accurately for file API endpoints thanks
to a few improvements in how it handles `multipart/form-data` payloads
and the OpenAPI spec.

Here we upgrade `stripe-mock` to 0.15.0 and remove the manual stubbing
that we had previously.
2018-05-04 11:31:11 -07:00
Olivier Bellone
949efb017d
Support Tempfiles in file_upload creation requests 2017-12-05 16:52:37 -08:00
Olivier Bellone
e02ff7f849
Start using RuboCop for linting 2017-09-27 21:28:25 +02:00
Brandur
00180c5f35 Power test suite with stripe-mock
Moves away from Committee and towards stripe-mock, an external
self-contained executable API stub server based on OpenAPI [1]. The
motivation here is that instead of making stripe-ruby a special
snowflake, we can use a single well-tested and feature-rich mock
implementation to drive every API's test suite.

[1] https://github.com/stripe/stripe-mock
2017-07-31 13:25:48 -07:00
Brandur
77c8535fa3 Properly encode file uploads
As described in #506, file uploads were broken on the way over to
Faraday and unfortunately I didn't catch it because the file upload
creation test wasn't using a matcher that was strict enough to really
catch anything.

Here we add the multipart middleware to our Faraday connection, add a
compatibility layer to `FileUpload` so that we can support `File` like
the rest-client based version always did (Faraday generally expects an
`UploadIO` object), and then tighten up our tests so that we'd be able
to catch future regressions.

Fixes #506.
2017-02-21 17:35:21 -08:00
Brandur
3f549fb5ad Port all tests over to OpenAPI
Follows the path established in 2d75c8f by porting the rest of
stripe-ruby's tests over to OpenAPI. There are a few other changes here
where I've removed some tests that are duplicated or don't make much
sense, or reorganized how we test certain things, but this commit is
largely the same migration operation applied in bulk a few dozen test
suites.
2017-02-14 12:17:37 -08:00
Brandur
3cf2ba3527 Use basic JSON.generate instead of make_response abstraction 2017-02-14 12:07:18 -08:00
Brandur
0019cfdc7e More updated tests 2017-02-14 12:07:18 -08:00
Brandur
42ea34b969 Pagination
Usage on a top-level collection:

```
Stripe::Customer.list.auto_paging_each do |customer|
  puts customer
end
```

Usage on a subcollection:

``` ruby
customer.invoices.auto_paging_each do |invoice|
  puts invoice
end
```

We've also renamed `#all` to `#list` to prevent confusion ("all" implies
that all resources are being returned, and in Stripe's paginated API
this was not the case). An alias has been provided for backward API
compatibility.

Fixes #167.

Replaces #211 and #248.
2015-10-05 12:15:09 -07:00
Andrew Thorp
841a34385a Use correct URL for file upload retrieval 2015-10-01 17:36:51 -07:00
Kyle Conroy
b3610798c2 Rename test data methods 2015-07-02 11:51:38 -07:00
wangjohn
ad26262a2c Adding support for listing file uploads. 2015-01-12 12:44:46 -08:00
wangjohn
ef249b7ceb Create the file upload api resource (+ bump version) 2014-12-22 18:04:53 -08:00