13 Commits

Author SHA1 Message Date
Olivier Bellone
21db64fe0e
Use ::File instead of File 2018-08-27 15:32:10 +02:00
Brandur
863da48398 Add frozen_string_literal to every file and enforce Rubocop rule
Adds the magic `frozen_string_literal: true` comment to every file and
enables a Rubocop rule to make sure that it's always going to be there
going forward as well.

See here for more background [1], but the basic idea is that unlike many
other languages, static strings in code are mutable by default. This has
since been acknowledged as not a particularly good idea, and the
intention is to rectify the mistake when Ruby 3 comes out, where all
string literals will be frozen. The `frozen_string_literal` magic
comment was introduced in Ruby 2.3 as a way of easing the transition,
and allows libraries and projects to freeze their literals in advance.

I don't think this is breaking in any way: it's possible that users
might've been pulling out one of are literals somehow and mutating it,
but that would probably not have been useful for anything and would
certainly not be recommended, so I'm quite comfortable pushing this
change through as a minor version.

As discussed in #641.

[1] https://stackoverflow.com/a/37799399
2018-05-10 14:56:14 -07: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
96e03a8443 Update some OpenAPI repository conventions
See [1] for details, but a few conventions changed around the structure
of the OpenAPI repository and the data within the fixtures file. Here we
put in some minor changes to compensate for them.

[1] https://github.com/stripe/openapi/pull/3
2017-03-23 16:28:36 -07:00
Brandur
90344eeaa0 Point certificate bundle URL directly at cURL
We were using this GitHub link instead because the cURL site didn't
support HTTPS for the longest time. They do now, so repoint this URL.
2017-03-15 10:44:59 -07:00
Brandur
4d7019bee6 Move OpenAPI spec from spec/ to openapi/
Naming a directory `spec` in a Ruby project is terribly ambiguous. This
clarifies the purpose of this directory and makes it easier to find if
you know that you're looking for OpenAPI.
2017-03-14 17:07:50 -07:00
Brandur
3b193db847 Add script to update the OpenAPI specification
Also fixes the task to retrieve a CA bundle which broke on the upgrade
from rest-client to Faraday.
2017-03-14 17:07:49 -07:00
Brandur
1886d9a625 Move to an alternative system based on StripeClient 2017-02-14 12:17:37 -08:00
Brandur
31bbf02d4d Update CA bundle
Our CA bundle has fallen quite out of date since it was last pulled.
This patch updates it and adds a Rake task to make this task more
repeatable.

One thing worth noting is I've switched us over from the Ubuntu bundle
to the Mozilla bundle that's maintained by cURL. The bundle seemed to be
previously extracted by a custom script that I don't really want to
maintain. cURL and Excon both use the Mozilla bundle and it should be a
safe replacement.
2016-01-26 14:32:16 -08:00
Russell Davis
2827ad15d6 Run tests using TestTask
- Runs all tests at once instead of one at a time, this way we don't pay
the cost of constantly reloading the environment. Takes test time from 20
seconds to 4.

- Removes the separate testing using activesupport/all, which wasn't actually
doing anything since the tests were running in a separate process.

Thanks to @JoshCheek for surfacing these issues.
2014-07-11 14:54:21 -07:00
David Czarnecki
e593b0e0df Breakup tests into separate test files 2013-03-22 17:20:04 -04:00
Evan Broder
eee7ab5c44 Add a Rakefile for running tests 2012-05-04 03:06:38 -07:00