Skip to content

Commit

Permalink
Add spec to validate behaviour of Async.logger.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Mar 22, 2019
1 parent d294a58 commit 1b836a2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion async.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |spec|

spec.add_runtime_dependency "nio4r", "~> 2.3"
spec.add_runtime_dependency "timers", "~> 4.1"
spec.add_runtime_dependency "event", "~> 1.1"
spec.add_runtime_dependency "event", "~> 1.3"

spec.add_development_dependency "async-rspec", "~> 1.1"

Expand Down
1 change: 1 addition & 0 deletions lib/async/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
require_relative 'task'

module Async
# @return the current logger, either the active tasks logger, or the global event console logger.
def self.logger
if task = Task.current?
task.logger
Expand Down
2 changes: 2 additions & 0 deletions spec/async/logger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
Async do |parent|
parent.async(logger: logger) do |task|
expect(task.logger).to be == logger
expect(Async.logger).to be == logger
end.wait
end.wait
end
Expand All @@ -56,6 +57,7 @@

expect(parent.logger).to be == logger
expect(child.logger).to be == logger
expect(Async.logger).to be == logger
end.wait
end
end

0 comments on commit 1b836a2

Please sign in to comment.