Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove minitest gem altogether, make specs more rspec-y, add a spec for the array form of :on #62

Merged
merged 49 commits into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0542dd5
Merge pull request #1 from kamui/master
apurvis Sep 10, 2017
4686c3a
Merge pull request #2 from kamui/master
apurvis Sep 29, 2017
07975bc
Merge pull request #3 from kamui/master
apurvis Oct 6, 2017
bdc7e91
Merge branch 'kamui_master'
Nov 7, 2017
523569e
Merge pull request #4 from kamui/master
apurvis Jan 5, 2018
842caee
Merge branch 'kamui_master'
Feb 27, 2018
43639f5
Merge branch 'master' of github.com:apurvis/retriable
Feb 27, 2018
7462068
Switch to rspec
Feb 27, 2018
acf2a72
Move the srand setting into the global rspec config
Feb 27, 2018
b0b8e34
check the exception message; remove jruby from allowable failures
Feb 27, 2018
9046d73
Address some hounds; move test exceptions to support file
Feb 27, 2018
874c037
Address some hound comments
Feb 27, 2018
67a9648
Merge branch 'kamui_master' into rspec
Feb 27, 2018
fc06e2f
Appease some hounds
Feb 27, 2018
16f6d04
More rpsec styley
Feb 27, 2018
943f2b2
get rid of minitest altogether
Feb 27, 2018
6d18c04
Merge branch 'kamui_master'
Feb 27, 2018
30b64d6
Merge master
Feb 27, 2018
2332b41
README
Feb 27, 2018
def5753
Make tests more rspec-y
Feb 27, 2018
b9c0b63
hound
Feb 27, 2018
7a4d156
Even more DRYing up of spec code
Feb 27, 2018
145e11f
rspec switch
Feb 27, 2018
048d26e
Add .rspec file
Feb 27, 2018
813908d
Fix warning; some rspec style
Feb 28, 2018
3d955ef
Reorganize some specs
Feb 28, 2018
7ffb6e1
Rename TestError to NonStandardError for clarity; simplify the defaul…
Feb 28, 2018
1e7fb11
Add a spec for array :on parameter; use the be_a rspec matcher
Feb 28, 2018
62ffc71
refactor 0 rand factor section into context
Feb 28, 2018
5014d9c
refactor 0 rand factor section into context
Feb 28, 2018
e48e267
DRYify
Feb 28, 2018
abcd830
even more DRY
Feb 28, 2018
34af7e0
Hound
Feb 28, 2018
fc10c20
use described_class where appropriate
Feb 28, 2018
b77d7ba
Use standard args for standard specs
Feb 28, 2018
cf3d7b2
Fix rspec gemspec dependency (not sure how this ever worked)
Feb 28, 2018
8824531
rename spec variable
Feb 28, 2018
9b1a12b
better invalid options spec
Feb 28, 2018
d550895
better spec description
Feb 28, 2018
1c7a250
check error message on bad argument exception
Feb 28, 2018
879b322
hound
Feb 28, 2018
80d5d87
update the rubinius version so that the travis build doesn't fail: ht…
Feb 28, 2018
262d7c0
try rubinius 3.99
Feb 28, 2018
c1ec548
try formatting the rspec output to see wtf rubinius doesn't agree with
Feb 28, 2018
7f25be5
always run rspec with full formatting
Feb 28, 2018
2680a60
always run rspec with full formatting
Feb 28, 2018
5718bf6
update travis ruby matrix to latest bugfixed releases
Feb 28, 2018
cf65093
Update ruby version test matrix
May 28, 2018
68e2d59
update rubocop.yml with latest cop names
May 28, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## HEAD

* Replace `minitest` gem with `rspec`
* Fancier README
* Remove unnecessary short circuit in `randomize` method

Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ gemspec

group :test do
gem "codeclimate-test-reporter", require: false
gem "minitest-focus"
gem "rspec"
gem "simplecov", require: false
end
Expand Down
8 changes: 0 additions & 8 deletions Guardfile

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,9 @@ RetriableProxy.for_object(api_endpoint, on: Net::TimeoutError)
## Credits

The randomized exponential backoff implementation was inspired by the one used in Google's [google-http-java-client](https://code.google.com/p/google-http-java-client/wiki/ExponentialBackoff) project.

## Development
### Running Specs
```bash
bundle exec rspec
```
12 changes: 0 additions & 12 deletions Rakefile

This file was deleted.

6 changes: 1 addition & 5 deletions retriable.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = ">= 2.0.0"

spec.add_development_dependency "bundler"
spec.add_development_dependency "rake", "~> 12.0"

spec.add_development_dependency "minitest", "~> 5.10"
spec.add_development_dependency "guard"
spec.add_development_dependency "guard-minitest"
spec.add_development_dependency "rspec", "~> 12.0"

if RUBY_VERSION < "2.3"
spec.add_development_dependency "ruby_dep", "~> 1.3.1"
Expand Down
26 changes: 12 additions & 14 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,51 +1,49 @@
require_relative "spec_helper"

describe Retriable::Config do
let(:config) { described_class.new }
let(:default_config) { described_class.new }

context "defaults" do
it "sleep defaults to enabled" do
expect(config.sleep_disabled).to be_falsey
expect(default_config.sleep_disabled).to be_falsey
end

it "tries defaults to 3" do
expect(config.tries).to eq(3)
expect(default_config.tries).to eq(3)
end

it "max interval defaults to 60" do
expect(config.max_interval).to eq(60)
expect(default_config.max_interval).to eq(60)
end

it "randomization factor defaults to 0.5" do
expect(config.base_interval).to eq(0.5)
expect(default_config.base_interval).to eq(0.5)
end

it "multiplier defaults to 1.5" do
expect(config.multiplier).to eq(1.5)
expect(default_config.multiplier).to eq(1.5)
end

it "max elapsed time defaults to 900" do
expect(config.max_elapsed_time).to eq(900)
expect(default_config.max_elapsed_time).to eq(900)
end

it "intervals defaults to nil" do
expect(config.intervals).to be_nil
expect(default_config.intervals).to be_nil
end

it "timeout defaults to nil" do
expect(config.timeout).to be_nil
expect(default_config.timeout).to be_nil
end

it "on defaults to [StandardError]" do
expect(config.on).to eq([StandardError])
expect(default_config.on).to eq([StandardError])
end

it "on retry handler defaults to nil" do
expect(config.on_retry).to be_nil
expect(default_config.on_retry).to be_nil
end

it "contexts defaults to {}" do
expect(config.contexts).to eq({})
expect(default_config.contexts).to eq({})
end
end

Expand Down
8 changes: 1 addition & 7 deletions spec/exponential_backoff_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require_relative "spec_helper"

describe Retriable::ExponentialBackoff do
context "defaults" do
let(:backoff_config) { described_class.new }
Expand Down Expand Up @@ -56,11 +54,7 @@
end

it "generates intervals with a defined max interval" do
expect(described_class.new(max_interval: 1.0, rand_factor: 0.0).intervals).to eq([
0.5,
0.75,
1.0,
])
expect(described_class.new(max_interval: 1.0, rand_factor: 0.0).intervals).to eq([0.5, 0.75, 1.0])
end

it "generates intervals with a defined rand_factor" do
Expand Down
Loading