• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-ruby / 3435
96%
master: 97%

Build:
Build:
LAST BUILD BRANCH: HEAD
DEFAULT BRANCH: master
Ran 04 Sep 2019 09:34PM UTC
Jobs 5
Files 97
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
3435

Pull #847

travis-ci

web-flow
Change some error tests to use `assert_raises`

Previously, we had quite a few error tests that were written like this:

``` ruby
begin
  client.execute_request(:post, "/v1/charges")
rescue Stripe::InvalidRequestError => e
  assert_equal(404, e.http_status)
  assert_equal(true, e.json_body.is_a?(Hash))
end
```

The trouble with that pattern is that although they'll _usually_ work,
the test will incorrectly pass if no error at all is thrown because the
`rescue` never activates and therefore the assertions never run.

We change them to use `assert_raises` like so:

``` ruby
e = assert_raises Stripe::InvalidRequestError do
  client.execute_request(:post, "/v1/charges")
end
assert_equal(404, e.http_status)
assert_equal(true, e.json_body.is_a?(Hash))
```

The weird part is that many of the tests were already using
`assert_raises`, so here we're just converting them all over to use the
same convention.

I've also made a few whitespace tweaks. None of them are significant,
but they were an attempt to standardize a little on the whitespace
layout of many of these tests which were similar.
Pull Request #847: Change some error tests to use `assert_raises`

1855 of 1932 relevant lines covered (96.01%)

2437.19 hits per line

Jobs
ID Job ID Ran Files Coverage
1 3435.1 (2.3) 04 Sep 2019 09:34PM UTC 0
96.12
Travis Job 3435.1
2 3435.2 (2.4) 04 Sep 2019 09:34PM UTC 0
96.12
Travis Job 3435.2
3 3435.3 (2.5) 04 Sep 2019 09:34PM UTC 0
96.12
Travis Job 3435.3
4 3435.4 (2.6) 04 Sep 2019 09:34PM UTC 0
96.09
Travis Job 3435.4
5 3435.5 (jruby-9.2.7.0) 04 Sep 2019 09:37PM UTC 0
0.0
Travis Job 3435.5
Source Files on build 3435
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #3435
  • Pull Request #847
  • PR Base - master (#3433)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc