This repository has been archived by the owner. It is now read-only.
forked from hirefire/hirefire
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hirefire#17 from nbibler/test_cleanup.
Spec support file organization
- Loading branch information
Showing
2 changed files
with
35 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module ConfigurationHelper | ||
def configure(&block) | ||
HireFire.configure(&block) | ||
end | ||
|
||
def with_configuration(&block) | ||
old_configuration = HireFire.configuration | ||
HireFire.configuration = HireFire::Configuration.new | ||
yield(HireFire.configuration) | ||
ensure | ||
HireFire.configuration = old_configuration | ||
end | ||
|
||
def with_max_workers(workers, &block) | ||
with_configuration do |config| | ||
config.max_workers = workers | ||
yield | ||
end | ||
end | ||
|
||
def with_min_workers(workers, &block) | ||
with_configuration do |config| | ||
config.min_workers = workers | ||
yield | ||
end | ||
end | ||
end | ||
|
||
RSpec.configure do |config| | ||
config.include ConfigurationHelper | ||
end |