45 Commits

Author SHA1 Message Date
Brandur
7f85eea3ee Fix low hanging Rubocop TODOs
I wanted to see what fixing Rubocop TODOs was like, so I tried to
eliminate all the easy ones. Most of these were pretty easy, and the
changes required are relatively minimal.

Some of the stuff left is harder. Pretty much everything under
`Metrics/*` is going to be a pretty big yak shave. A few of the others
are just going to need a little more work (e.g. `Style/ClassVars` and
`Style/GuardClause`). Going to stop here for now.
2017-09-27 15:07:18 -07:00
Olivier Bellone
e02ff7f849
Start using RuboCop for linting 2017-09-27 21:28:25 +02:00
Brandur
ed6d7a7cf9 Upgrade stripe-mock to 0.2.0
This pulls us onto the new version of stripe-mock which should be
checking parameters more accurately now that it's on OpenAPI 3.0.
2017-09-22 12:01:30 -07:00
Brandur
ce69d749e1 Implement STRIPE_LOG for stripe-ruby
Adds logging support for stripe-ruby in a similar way that we did it for
stripe-python [1], with the idea that users you can optionally get some
additional low-cost-to-configure logging for operational visibility or
debugging.

I made a few tweaks from the Python implementation (which I'll try to
contribute back to there):

* Added an elapsed parameter to responses so you can tell how long they
  lasted.
* Mixed in idempotency_key to all lines that users have a way to
  aggregate logs related to a request from start to finish.
* Standardized naming between different log lines as much as possible.
* Detect a TTY and produce output that's colorized and formatted.

[1] https://github.com/stripe/stripe-python/pull/269
2017-08-03 13:39:15 -07: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
f0579950a7 Add testing infrastructure to use spec and fixtures
Adds some testing infrastructure that reads in the OpenAPI spec and its
fixtures. These changes will allow us to starting porting over each of
stripe-ruby's test suites.
2017-02-14 12:17:37 -08:00
Brandur
7ed2abffdd Remove support for Ruby 1.9
This has been discussed, but we'll finally be doing it for the next
major version so that we can introduce a few features that depend on
gems that don't support 1.9.
2017-02-14 12:07:18 -08:00
Brandur
1e166d9be7 Fix Gem builds in CI
CI is failing for a number of Ruby versions because shoulda is pulling
in should-matchers, which then pulls in activesupport. activesupport's
new 5.0.0 version is being picked up, and that requires at least Ruby
2.2.2.

Luckily the solution is easy, we're not using shoulda-matchers, only
shoulda-context, so just tighten up our dependencies a little and the
problem goes away.
2016-07-01 15:44:32 -07:00
Brandur
8f55baa6ea Fix warnings emitted during tests
I'm not sure exactly what changed here (did we change the `$VERBOSE`
setting?), but I'm not seeing a whole lot of warnings when running the
test suites locally and in CI. For example:

```
Started
........................................./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
............../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
......../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
.../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
........./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
...
..../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
....../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
..../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
......./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
........./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
........../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
................./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
.../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
..../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
....../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
..........
........./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
....../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
......../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
......../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
............./home/travis/build/stripe/stripe-ruby/lib/stripe/stripe_object.rb:35: warning: instance variable @values not initialized
./home/travis/build/stripe/stripe-ruby/lib/stripe/stripe_object.rb:35: warning: instance variable @values not initialized
...................../home/travis/build/stripe/stripe-ruby/lib/stripe/transfer.rb:8: warning: instance variable @api_key not initialized
..............
..
Finished in 0.785621037 seconds.
```

Most of these are due to unused or uninitialized variables. This patch
fixes all warnings by fixing offending code.
2016-04-11 15:20:42 -07:00
Brandur
5769eb7c1e More consistent spacing 2015-11-03 09:31:21 -08:00
Russell Davis
d6e2dae298 Change Helpers to Stripe::TestData 2014-11-14 14:10:45 -08:00
Harlow Ward
cdfbfee06c Extract response helpers to module
Allow developers to use Stripe test data when stubbing responses
locally. This should help mitigate the risk of API drift with stubbed
responses.

* Move response helpers to their own file
2014-11-13 23:19:46 -08:00
Kyle Conroy
8d066ca608 Add coupon update 2014-08-06 16:10:18 -07:00
Cosmin Nicolaescu
d3dfa18990 make ApplicationFee.refunds a list object instead of array 2014-07-28 23:28:24 -07:00
Kyle Conroy
e59a494215 Add support for refund resource 2014-06-16 17:13:57 -07:00
Stephen Wan
f13a050935 Added support for transfer cancelation 2014-05-26 11:30:20 -07:00
Michelle Bu
57309a05de Add tests for cards 2014-05-21 16:27:49 -07:00
Andrew Thorp
9b3a3a020b Merge pull request #106 from stripe/replace-multi-json-with-json
Replace multi_json with json
2014-01-29 17:49:41 -08:00
Jim Danz
d2058b3d1a Fixup old tests for new param style in test_subscription 2014-01-29 16:34:48 -08:00
Andrew Thorp
9ead81b352 replace multi_json with json, fixes #101 2014-01-24 23:27:25 -08:00
Pat Allan
ee42d9c583 Adding tests for Subscription. 2014-01-22 17:09:49 +11:00
Amber Feng
127e906d60 Unit tests for ApplicationFee. 2013-11-14 14:04:55 -08:00
kiran-b
1724f85e26 tests for metadata 2013-10-08 21:01:13 -07:00
Michelle Bu
f9b13dfc2a active_card is no longer a thing 2013-10-07 10:05:59 -07:00
Finbarr Taylor
0851f2a7fd Added BalanceTransaction list resource.
Added Balance singleton resource.
2013-08-13 20:53:19 +01:00
Sheena Pakanati
87604d945e Initial support for multiple cards. 2013-07-11 16:47:58 -07:00
Tim Craft
9ae705f845 Add version specifiers for activesupport/shoulda/mocha dev dependencies 2013-07-05 17:36:36 +01:00
Amber Feng
a7f7df94c6 Tests for transfers and recipients. 2013-04-11 18:00:47 -07:00
David Czarnecki
e593b0e0df Breakup tests into separate test files 2013-03-22 17:20:04 -04:00
Amber Feng
ce34d9ef8b Use Invoice.all instead of Invoice.upcoming for base query parameter tests. 2013-03-11 18:07:45 -07:00
Amber Feng
7ddf3ea42b Fix URL building for when the base URL already has query parameters, and add test. 2013-03-11 13:19:28 -07:00
Ross Boucher
7f87b2bc4a Add support for list objects. Bumps version to 1.7.5 2012-10-25 19:42:23 -07:00
Evan Broder
f7a69489af Add a test for invoice pay 2012-10-08 16:40:39 -07:00
Akash Manohar J
78bf6a6260 Changes order of require
Signed-off-by: Akash Manohar J <akash@akash.im>
2012-05-23 11:30:41 +05:30
Evan Broder
5f70ea3bbd Merge branch 'signal' 2012-05-04 22:52:14 -07:00
Evan Broder
32e619c04a Switch from deprecated MultiJson.{encode,decode} to .{dump,load}
Bump gem dependency accordingly
2012-04-23 10:18:57 -07:00
Brian Collins
a6de6e3be7 Use multi_json 2012-04-01 13:44:22 -07:00
John Wood
5921076da0 Add support for deleting the discount associated with the customer 2012-01-13 06:40:24 -06:00
Sheena Pakanati
94d8bdf681 Coupon support. 2011-10-11 22:06:51 -07:00
Ross Boucher
5fcaa49495 Update stripe tests for newer API format. 2011-09-15 14:09:03 -07:00
Bradley Grzesiak
16c3d4f3b9 Update syntax to work in ruby 1.9 2011-07-08 17:28:50 -07:00
Bradley Grzesiak
b03a4165df Remove circular dependency in gemspec 2011-07-08 17:28:50 -07:00
Greg Brockman
a981f4910c Put params for get/head/delete into query string 2011-07-04 19:23:40 -07:00
Ross Boucher
98a5766381 Fix for updating subscriptions.
Also switches tests to 'shoulda' from 'context'.
2011-06-20 11:49:15 -07:00
Greg Brockman
0813418b74 1.5.0 release 2011-05-26 11:47:01 -07:00