Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
language: ruby
rvm:
- 2.1.8
- 2.2.3
- 2.3.1
before_install: gem install bundler -v 1.10.6
- 3.3.4
before_install: gem install bundler -v 2.5
2 changes: 1 addition & 1 deletion lib/thread/inheritable_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(*args, &block)
_inheritable_attributes = inheritable_attributes.dup
_initialize(*args) do |*block_args|
store[:inheritable_attributes] = _inheritable_attributes
block.call(block_args)
block.call(*block_args)
end
end

Expand Down
8 changes: 8 additions & 0 deletions spec/thread/inheritable_attributes_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "thread/inheritable_attributes"
require "securerandom"

RSpec.describe Thread do
after { Thread.current.send(:store)[:inheritable_attributes] = nil }
Expand Down Expand Up @@ -33,6 +34,13 @@
Thread.new(a, b, c) { |d, e, f| arr << d << e << f }.join
expect(arr).to eq [1, 2, 3]
end

it "single arg is expanded properly" do
total = 1
a = 7
Thread.new(a) { |b| total += b }.join
expect(total).to eq 8
end
end

describe "#get_inheritable_attribute" do
Expand Down
2 changes: 1 addition & 1 deletion thread-inheritable_attributes.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.10"
spec.add_development_dependency "bundler", "~> 2.5"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.4"
spec.add_runtime_dependency "request_store", "~> 1.3"
Expand Down